Skip to content

codex-mcp: serialize connector runtime refreshes - #31472

Draft
mzeng-openai wants to merge 1 commit into
dev/mzeng/apps-runtime-state-managerfrom
dev/mzeng/apps-runtime-state-refresh
Draft

codex-mcp: serialize connector runtime refreshes#31472
mzeng-openai wants to merge 1 commit into
dev/mzeng/apps-runtime-state-managerfrom
dev/mzeng/apps-runtime-state-refresh

Conversation

@mzeng-openai

Copy link
Copy Markdown
Contributor

What

  • Add one async explicit-refresh lock per active connector runtime context.
  • Add McpConnectionManager::hard_refresh_codex_apps_runtime, which performs exactly one uncached Apps tools/list under that shared lock and returns the exact committed Arc<ConnectorRuntimeSnapshot>.
  • Start the host-owned Apps MCP client in initialize-only mode for the new strict path so startup cannot issue a second competing list request.
  • Keep legacy hard_refresh_codex_apps_tools / app/list behavior intact while routing its refresh through the same lock.
  • Retain the previously committed snapshot when fetch or publication fails.
  • Record the uncached list outcome/trigger and expose the committed snapshot to core for later consumers.

Why

This is stack PR 2 of 4, based on #31471. It creates the single refresh seam needed by request-stable runtime consumption and app/installed without changing app-server APIs yet.

Invariants

  • Concurrent explicit reloads serialize per account/workspace context.
  • A strict reload performs one network tools/list, then atomically publishes and returns that same committed state.
  • Generic tool filtering, exposure, approval, elicitation, and execution remain owned by McpConnectionManager.
  • The legacy app/list compatibility path remains available and retains its existing response behavior.

Checks

  • just test -p codex-mcp (114 passed)
  • just fmt

The broader codex-core suite was also compiled and exercised while developing this slice; its connector/MCP tests passed, with only the checkout's known sandbox/CLI-fixture failures in the full crate run.

@mzeng-openai
mzeng-openai force-pushed the dev/mzeng/apps-runtime-state-refresh branch from 9713df4 to adefe74 Compare July 8, 2026 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant