fix(codex): make MCP bootstrap sandbox-safe - #49
Merged
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixes the Codex plugin MCP startup failure on Windows where the client closed during the
initializeresponse.The plugin no longer relies on Codex expanding
${PLUGIN_ROOT}in MCP argv. A small bootstrap locates the matching installed plugin in Codex's cache, prefers the newest matching installation, and memory-loads the launcher. The launcher then memory-loads the bundled MCP server so Node does not perform the Windows sandbox-denied realpath walk through the user-profile parent directories.Regression coverage now exercises the real
.mcp.jsoncommand, nested project paths containing spaces, multiple cached plugin versions (including a broken stale version), clean stdio shutdown, and useful failure diagnostics.Root cause
Codex CLI 0.151.0 passed
${PLUGIN_ROOT}/dist/mcp-launcher.cjsliterally and did not providePLUGIN_ROOTto the MCP subprocess. After locating the installed bundle, launching it as a normal Node entry path could still fail under the Windows Codex sandbox while Node resolved user-profile parent directories. Either failure closed stdio before MCP initialization completed.Validation
pnpm lintpnpm typecheckpnpm build:pluginpnpm test— 215 files passed; 2,870 tests passed; 2 skippedpnpm test:perf— 3 files and 19 tests passedpnpm check:public-contractslist_mcp_resources(server=specbridge)completed and returnedspecbridge://workspaceandspecbridge://verification/rulesChecklist
pnpm lint,pnpm typecheck, andpnpm testpass locallypnpm check:public-contractspasses; no public contract changedCHANGELOG.mdSecurity invariants
This changes the plugin/MCP process-loading boundary and preserves the threat model's T09/T13 invariants: the server still receives the active project root separately from the trusted installed bundle root, stdout remains protocol-only, project writes stay governed by the existing workspace/protected-path checks, and candidate cache entries must match both the SpecBridge manifest identity and the exact configured bootstrap source. No arbitrary workspace path, shell, credential, network, approval, or write capability is added.