Skip to content

Centralize thread MCP state in McpRuntime - #34930

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/59eabb1aa8dc083426bd18ef4d3630508f376401
Jul 23, 2026
Merged

Centralize thread MCP state in McpRuntime#34930
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/59eabb1aa8dc083426bd18ef4d3630508f376401

Conversation

@copyberry

@copyberry copyberry Bot commented Jul 23, 2026

Copy link
Copy Markdown

Centralize thread MCP state in McpRuntime

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.
## 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
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/59eabb1aa8dc083426bd18ef4d3630508f376401 branch from 491b604 to e497325 Compare July 23, 2026 11:28
@copyberry
copyberry Bot merged commit e497325 into main Jul 23, 2026
31 of 32 checks passed
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/59eabb1aa8dc083426bd18ef4d3630508f376401 branch July 23, 2026 11:29
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 23, 2026
@dskw
dskw temporarily deployed to issue-triage July 23, 2026 11:34 — with GitHub Actions Inactive
@dskw
dskw temporarily deployed to issue-triage July 23, 2026 11:34 — with GitHub Actions Inactive
@dskw
dskw temporarily deployed to issue-triage July 23, 2026 11:34 — with GitHub Actions Inactive
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

2 participants