You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(server): preserve Codex MCP transports in text generation - #31282
Codex text generation replaces an entire mcp_servers CLI override table with entries containing only enabled=false. When a launcher supplied an MCP transport through an earlier -c override, this deletes its command/url and Codex exits with invalid transport before generating a title. The same helper serves other text-generation operations.
Append individual mcp_servers.<name>.enabled=false overrides instead, preserving launcher-provided transport fields. Codex splits raw dotted paths without interpreting TOML key quotes, so names containing quotes, backslashes, spaces or Unicode must remain raw argv values. Reject names containing dots, = or NUL before exec because that parser cannot address them safely. The error names the server and suggests renaming it or choosing another system model.
This is a small, focused fix for an obvious configuration layering defect. It does not add provider fallback or change title error presentation; visible failure reporting remains separate from this fix (see #5359).
Validation:
Existing text-generation test extended for multiple servers, a quoted/backslashed name, an already-disabled server and trailing plugin/app overrides; rejection cases cover dots, = and NUL.
A configuration-only regression exercised the actual makeCodexTextGeneration spawn path through a synthetic managed launcher and Codex CLI 0.159.1. The launcher injects nine stdio/HTTP servers via earlier CLI overrides. exec is intercepted and its generated config arguments are passed to real codex mcp list --json; the test checks every server is disabled and all transport fields are unchanged. No provider/model or MCP calls run. The pinned original source fails with invalid transport; this patch passes, including quotes, backslashes, spaces, Unicode and newline names. The repeatable real-CLI harness is attached to the fork patch release; extract and run regression-harness/run.sh /path/to/checkout /path/to/codex.
vp run check:changed 84537c4dd976a89b6ec094f43ae3ef7bee12cb1a --concurrency 1: all required steps pass (format, lint, both knip passes, generated GraphQL check, typecheck of 3 affected packages, 18 tests in 2 files).
Prepared with gpt-6.1-sol (high reasoning), Codex harness in T3 Code.
Macroscope's review found this PR approvable — Codex text generation now disables MCP servers through leaf overrides, preserving launcher-provided transport settings and rejecting names the CLI cannot safely address. The change remains confined to subprocess configuration and retains existing execution safeguards.
You can add or adjust custom eligibility rules. Learn more.
The Codex text-generation runner now disables enabled MCP servers with individual config overrides. It returns a TextGenerationError when an enabled server name contains a dot, equals sign, or null character. Tests cover valid and rejected names.
Changes: Codex MCP override handling
Layer / File(s)
Summary
Validate server names and build overrides apps/server/src/textGeneration/CodexTextGeneration.ts, apps/server/src/textGeneration/CodexTextGeneration.test.ts
The runner creates a separate mcp_servers.<name>.enabled=false override for each enabled server. It rejects names containing ., =, or a null character. Tests cover a quoted name with a backslash and spaces, plus the rejected name cases.
No merge-blocking issue is established. The rejected-name diagnostic remains a boundedness question.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title clearly and concisely describes the main change: preserving Codex MCP transport configuration during text generation.
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Description check
The description states the problem (launcher-supplied MCP transports are deleted by a whole-table mcp_servers override, causing Codex to fail with invalid transport), the change (per-server `mcp_s…
Full details: Description check
Explanation
The description states the problem (launcher-supplied MCP transports are deleted by a whole-table mcp_servers override, causing Codex to fail with invalid transport), the change (per-server mcp_servers.<name>.enabled=false overrides, plus rejection of names containing dots, =, or NUL), scope (small focused fix, explicitly excludes provider fallback and error presentation changes, references #5359), and verification (extended tests, a real-CLI regression, and a check:changed run with listed steps). It also names the model and harness used. The template's Scope and approval section asks for a linked triaged issue or maintainer-approved discussion, or an explanation of why a small obvious bug fix qualifies without one. The author gives the explanation ("small, focused fix for an obvious configuration layering defect") but links no issue or approval comment, so that part is only partly met. The Verification section is thorough and states the observed results. The description is mostly complete, so this check passes.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Tip
🎯 Customize your risk assessments
Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.
✅ Automatic approvals, with your rules
Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.
Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.
Keep the rejected server name out of the error detail.
If mcp list --json returns a long or sensitive name containing a rejected character, this branch copies the full name into TextGenerationError.detail. Report the invalid character category without the raw name, and update the assertion in the test. As per coding guidelines, “Attributes and log annotations stay bounded: no raw payloads, command arguments or output”; the exact value belongs only in cause.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
size:S10-29 changed lines (additions + deletions).vouch:unvouchedAuthor is not yet trusted in the VOUCHED list.
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Codex text generation replaces an entire
mcp_serversCLI override table with entries containing onlyenabled=false. When a launcher supplied an MCP transport through an earlier-coverride, this deletes its command/url and Codex exits withinvalid transportbefore generating a title. The same helper serves other text-generation operations.Append individual
mcp_servers.<name>.enabled=falseoverrides instead, preserving launcher-provided transport fields. Codex splits raw dotted paths without interpreting TOML key quotes, so names containing quotes, backslashes, spaces or Unicode must remain raw argv values. Reject names containing dots,=or NUL before exec because that parser cannot address them safely. The error names the server and suggests renaming it or choosing another system model.This is a small, focused fix for an obvious configuration layering defect. It does not add provider fallback or change title error presentation; visible failure reporting remains separate from this fix (see #5359).
Validation:
=and NUL.makeCodexTextGenerationspawn path through a synthetic managed launcher and Codex CLI 0.159.1. The launcher injects nine stdio/HTTP servers via earlier CLI overrides.execis intercepted and its generated config arguments are passed to realcodex mcp list --json; the test checks every server is disabled and all transport fields are unchanged. No provider/model or MCP calls run. The pinned original source fails withinvalid transport; this patch passes, including quotes, backslashes, spaces, Unicode and newline names. The repeatable real-CLI harness is attached to the fork patch release; extract and runregression-harness/run.sh /path/to/checkout /path/to/codex.vp run check:changed 84537c4dd976a89b6ec094f43ae3ef7bee12cb1a --concurrency 1: all required steps pass (format, lint, both knip passes, generated GraphQL check, typecheck of 3 affected packages, 18 tests in 2 files).Prepared with gpt-6.1-sol (high reasoning), Codex harness in T3 Code.