Skip to content

fix: reconcile transient MCP startup cancellations - #657

Open
jmeyers91 wants to merge 2 commits into
agentclientprotocol:mainfrom
jmeyers91:fix/mcp-startup-reconciliation
Open

jmeyers91 wants to merge 2 commits into
agentclientprotocol:mainfrom
jmeyers91:fix/mcp-startup-reconciliation

Conversation

@jmeyers91

Copy link
Copy Markdown

Codex 0.146/0.147 is documented emitting starting -> cancelled -> starting -> ready for an MCP server that remains healthy (openai/codex#36682). I have not reproduced that producer behavior on the currently pinned Codex 0.160.1; this change makes the adapter handle the documented sequence safely.

I recheck cancelled server names through the existing read-only, thread-scoped mcpServerStatus/list path with a five-second overall deadline covering requests, pagination, and polling. Sessions without cancellations make no extra status requests. A cancelled card is suppressed only when the latest complete snapshot says that server is currently connected. Status errors, incomplete pagination, timeout, and genuine cancellation preserve the failure. Session close aborts reconciliation, late responses cannot continue pagination or publish, and already-confirmed failures retain their existing publication timing.

Both ACP versions have regression coverage for transient and permanent cancellations and repeated-cursor rejection. Additional controls cover thread scoping, read-only calls, a hung request and deadline, close with a late response, and multi-server latest-snapshot behavior. Removing the complete-pagination guard makes both new repeated-cursor cases fail.

Validation:

  • Final focused regression: 9 passed.
  • Typecheck passed at the final commit.
  • Full unit suite at b91bf85: 1874 passed, 36 skipped.
  • Build and all six bundles using Bun 1.3.11 passed at b91bf85.
  • The final commit adds only the repeated-cursor test; production code is byte-identical to b91bf85.

The existing foreground-state v2 integration mismatch was reproduced on the exact upstream base in the same environment during the preceding contribution. The integration suite was not rerun for this change.

@jmeyers91
jmeyers91 marked this pull request as ready for review October 20, 2026 22:45

This branch has not been deployed

No deployments
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