Centralize thread MCP state in McpRuntime - #34930
Merged
copyberry[bot] merged 1 commit intoJul 23, 2026
Merged
Conversation
## What changed - Make `McpRuntime` own the published MCP configuration, connections, elicitation routing, and selected capability roots for a thread. - Capture immutable MCP bindings for model steps and tool calls so in-flight work keeps a consistent connection set and approval authority while refreshed state is published atomically. - Mark MCP state dirty when relevant configuration, plugins, environments, authentication, or elicitation capabilities change, then rebuild it before the next sampling request or out-of-band MCP operation. - Separate config reloads from server invalidation: `ReloadMcpConfig` applies resolved MCP inputs, while `RefreshMcpServers` requests reinitialization from the thread's latest state. ## Testing - Cover refreshed state visibility for existing turns, stable step bindings, current approval authority, cancelled refresh retries, resource-client reconciliation, and Apps recovery between sampling requests. GitOrigin-RevId: 59eabb1aa8dc083426bd18ef4d3630508f376401
copyberry
Bot
force-pushed
the
copyberry/codex-internal-to-codex-oss/59eabb1aa8dc083426bd18ef4d3630508f376401
branch
from
July 23, 2026 11:28
491b604 to
e497325
Compare
copyberry
Bot
deleted the
copyberry/codex-internal-to-codex-oss/59eabb1aa8dc083426bd18ef4d3630508f376401
branch
July 23, 2026 11:29
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Centralize thread MCP state in
McpRuntimeWhat changed
McpRuntimeown the published MCP configuration, connections, elicitation routing, and selected capability roots for a thread.ReloadMcpConfigapplies resolved MCP inputs, whileRefreshMcpServersrequests reinitialization from the thread's latest state.Testing