Repository navigation
feat(core): add spawn-time MCP allowlists for subagents - #1
Draft
NgoQuocViet2001 wants to merge 1 commit into
Draft
NgoQuocViet2001 wants to merge 1 commit into
NgoQuocViet2001 wants to merge 1 commit into
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.
Review artifact for openai#38353
@openai/codex-core-agent-team — this is a tested implementation of the spawn-time MCP scoping proposed in openai/codex#38353.
I am intentionally opening this as a draft inside my fork, not as an unsolicited upstream PR: Codex's contribution policy says external code contributions are invitation-only. If the direction is acceptable, this branch is ready to retarget after a maintainer invitation.
Problem
A spawned subagent currently inherits the parent's complete MCP configuration. For stdio servers, each child can start another process for every configured MCP server. The resulting growth is roughly subagents × MCP servers, even when most children never use those tools.
On Windows this reproduced as dozens of idle Python MCP process pairs, memory pressure, and app-server/control-plane starvation: the parent task remained "running", but new user messages could no longer be processed.
Proposed contract
Both V1 and V2
spawn_agentgain an optionalmcp_allowfield:[]["server_a"]Names are trimmed and deduplicated. Unknown or disabled names fail the spawn closed and report the currently available names.
Omission intentionally snapshots an exact grant instead of leaving an inherit-all sentinel. That prevents later config/plugin changes or a cold resume from silently broadening a child's MCP capabilities.
Implementation
SessionMetaand thread-store creation/revert paths.Validation
mcp_allow: []reaches the child runtime catalog.just test -p codex-protocol: 271/271 passed.just test -p codex-history: 14/14 passed.just test -p codex-thread-store: 213/213 passed.just test -p codex-rollout: 119/119 passed.cargo check -p codex-app-server --tests: passed.Related implementation discussion and reproduction evidence: issue comment.