codex-mcp: serialize connector runtime refreshes - #31472
Conversation
8c06c05 to
85cc749
Compare
d05c7cc to
9713df4
Compare
9713df4 to
adefe74
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: adefe7420c
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| mcp_manager.connector_runtime_manager().current_snapshot( | ||
| config.codex_home.to_path_buf(), | ||
| connector_runtime_context_key(auth), | ||
| ) |
There was a problem hiding this comment.
Avoid activating runtimes during snapshot reads
When this read-only helper is called for a different auth/codex_home while another session's Codex Apps runtime is active, ConnectorRuntimeManager::current_snapshot calls context(...), which activates the requested identity and discards the entry held by the live McpConnectionManager. That makes connector_runtime_context_is_active() fail and drops that live session's Apps tools from later model requests, so this lookup should inspect the active identity without creating a new context.
AGENTS.md reference: AGENTS.md:L93-L96
Useful? React with 👍 / 👎.
| CodexAppsStartupMode::InitializeOnly, | ||
| ) | ||
| .await; | ||
| let snapshot = connection_manager.hard_refresh_codex_apps_runtime().await; |
There was a problem hiding this comment.
Cover strict Apps refresh with an integration test
This introduces a new core path that starts the host-owned Apps manager in InitializeOnly mode and then performs the explicit runtime refresh, but the commit only adds codex-mcp unit coverage for the lock; I checked refresh_connector_runtime_snapshot/hard_refresh_codex_apps_runtime in core/tests/suite and connectors_tests.rs and found no integration coverage. Because this path determines the agent-facing connector runtime snapshot, a regression could silently issue both startup and explicit tools/list or return a snapshot different from the committed one, so please add a test_codex Apps mock test that asserts one tools/list and the published snapshot.
AGENTS.md reference: AGENTS.md:L114-L118
Useful? React with 👍 / 👎.
What
McpConnectionManager::hard_refresh_codex_apps_runtime, which performs exactly one uncached Appstools/listunder that shared lock and returns the exact committedArc<ConnectorRuntimeSnapshot>.hard_refresh_codex_apps_tools/app/listbehavior intact while routing its refresh through the same lock.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/installedwithout changing app-server APIs yet.Invariants
tools/list, then atomically publishes and returns that same committed state.McpConnectionManager.app/listcompatibility path remains available and retains its existing response behavior.Checks
just test -p codex-mcp(114 passed)just fmtThe broader
codex-coresuite 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.