Skip to content

🤖 refactor: canonicalize config schema ownership and boundaries#2649

Open
ethanndickson wants to merge 5 commits intomainfrom
config-schemas-qnqf
Open

🤖 refactor: canonicalize config schema ownership and boundaries#2649
ethanndickson wants to merge 5 commits intomainfrom
config-schemas-qnqf

Conversation

@ethanndickson
Copy link
Member

@ethanndickson ethanndickson commented Feb 26, 2026

Summary

This PR centralizes config and shared schema ownership so each schema/enum is defined once in a stable layer, then consumed via re-exports where needed. It removes config↔ORPC dependency inversions, breaks the task-settings circular dependency, and adds lint guardrails to prevent regressions.

Closes #2572.

Background

Recent schema work uncovered several duplication and dependency-boundary problems:

  • config schemas importing from ORPC schemas
  • a circular dependency between appConfigOnDisk and types/tasks
  • duplicated provider/task/log/MCP enums across multiple files
  • weak boundary enforcement allowing regressions

This refactor makes ownership explicit and aligns consumers around canonical schemas.

Implementation

  • Added neutral schema modules:
    • src/common/schemas/ids.ts
    • src/common/schemas/project.ts
  • Converted ORPC schema modules to consume/re-export canonical ownership where appropriate.
  • Extracted task settings into a dedicated leaf module:
    • src/common/config/schemas/taskSettings.ts
  • Moved provider model entry schema into config ownership:
    • src/common/config/schemas/providerModelEntry.ts
  • Canonicalized provider enums (cacheTtl, serviceTier, codexOauthDefaultAuth) and reused across ORPC/config.
  • Removed dead ThinkingLevelSchema re-export from appConfigOnDisk.
  • Tightened ConfigMutationPathSchema with .max(5).
  • Deduplicated local enums in api.ts (background process status, log level).
  • Reused MCPTransportSchema in telemetry instead of a duplicate enum.
  • Added ESLint boundary rules to prevent ORPC/config import regressions.
  • Synced generated docs/schemas required by formatting/static-check.

Validation

  • make static-check
  • bun test src/common/config/schemas/appConfigOnDisk.test.ts
  • bun test src/common/config/schemas/providersConfig.test.ts
  • bun test src/common/orpc/schemas/api.test.ts
  • bun test src/node/utils/providerRequirements.test.ts
  • bun test src/node/services/tools/mux_config_write.test.ts

Risks

  • Low-to-medium: This is broad schema plumbing work touching shared config/ORPC boundaries.
  • Main mitigations are canonicalized definitions, passing static-check, focused runtime-facing tests, and successful manual settings/agent-flow verification.

Generated with mux • Model: openai:gpt-5.3-codex • Thinking: xhigh • Cost: $53.42

@ethanndickson
Copy link
Member Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cb3ae2e8aa

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ethanndickson
Copy link
Member Author

@codex review

@ethanndickson
Copy link
Member Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 699ca46b3c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ethanndickson
Copy link
Member Author

@codex review

@ethanndickson
Copy link
Member Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 623f33aca2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ethanndickson
Copy link
Member Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: be4c14836e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ethanndickson
Copy link
Member Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 242bba4040

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

if (workspaceGuard) return workspaceGuard;

const muxHome = getMuxHomeFromWorkspaceSessionDir(config, "mux_config_read");
const rawDocument = await readConfigDocument(muxHome, args.file);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Allow reading invalid config documents for recovery

mux_config_read currently uses readConfigDocument, which validates the entire file before returning any data. In recovery scenarios this blocks the tool completely—for example, a config containing an out-of-range taskSettings.maxParallelAgentTasks (which mux_config_write is explicitly built to repair) will cause reads to fail with success: false, so the assistant cannot inspect current values before applying a fix. This makes malformed configs much harder to recover from in Chat with Mux.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow Chat with Mux to configure models, providers, and other config

1 participant