app-server: add turn-scoped MCP metadata by server#24166
Draft
mzeng-openai wants to merge 1 commit into
Draft
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.
Why
App-server clients need a way to pass turn-scoped metadata to model-initiated tool calls for a particular MCP server, such as request location metadata for search, without exposing the broader
responsesapiClientMetadatabag to every MCP server used during the turn.What changed
turn/start.mcpMetaByServer, keyed by configured MCP server name, and carry it through turn startup and active-turn steering._metaonly for model-initiated calls routed through the matching server. An entry for an aggregate server such ascodex_appstherefore applies to connector tools routed through that server.responsesapiClientMetadatascoped to Responses API requests rather than forwarding it to MCP requests.Verification
cargo test -p codex-protocolcargo test -p codex-app-server-protocolcargo test -p codex-rollout-tracecargo test -p codex-core --lib mcp_tool_call_request_metacargo test -p codex-core --lib turn_metadata_state_merges_client_metadata_without_replacing_reserved_fieldscargo test -p codex-core --lib steer_input_returns_active_turn_idcargo test -p codex-core mcp_tool_call_receives_turn_metadata_for_selected_servercargo test -p codex-app-server --test all turn_start_updates_sandbox_and_cwd_between_turns_v2cargo check -p codex-mcp-server -p codex-thread-manager-samplejust write-app-server-schemaandjust write-app-server-schema --experimental; stable fixtures remain unchanged because the new field is experimental.Known issue
cargo test -p codex-coreaborts inthread_manager::tests::resume_and_fork_do_not_restore_thread_environments_from_rolloutwith a stack overflow; the same test reproduces when run in isolation, while the feature-specific core tests above pass.