Conversation
Codex snapshots the model-facing tool catalog at turn/start. A stdio server still in starting is left out, so the first turn only sees the servers that finished first. Hold the turn until each reported server leaves starting, and let a later ready replace a spurious cancelled. A 30s bound still starts the turn when a server never finishes.
macodev00
force-pushed
the
cursor/codex-mcp-catalog-startup-4d6e
branch
from
October 4, 2026 06:46
e593008 to
a765f36
Compare
Owner
Author
|
Opened upstream. |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes pingdotgg#13437
Problem
Codex snapshots the model-facing tool catalog at
turn/start. Optional stdio MCP servers that are stillstartingare omitted after a short grace, so the first turn only binds the servers that finished first. Later servers can bereadybefore the model answers and still be missing from that snapshot.What Changed
CodexAdapterV2recordsmcpServer/startupStatus/updatedand holdsturn/startuntil every server that has reported in for the thread leavesstarting.readyreplaces a spuriouscancelled(app-server:thread/startemits duplicate MCP startup notifications, including a spuriouscancelled, for servers that were only started once openai/codex#36682).cancelleddoes not replaceready.readyorfaileddoes not delay the turn. A thread with no startup notifications returns immediately.startingorcancelledat the deadline are marked unavailable for that thread, so a hung server does not add 30 seconds to every later turn. A newstartingafter that blocks again.threadIdapply to every thread. A thread-specific phase wins.This does not call
config/mcpServer/reload. That RPC only queues a refresh and an explicit refresh reconnects every configured server.Scope and approval
Accepted bug, triaged in pingdotgg#13437. Julius confirmed the race on
mainand prescribed a bounded wait beforeturn/startuntil each expected server leavesstarting, keyed by server name, with a laterreadywinning over a spuriouscancelled.Verification
Test Files 1 passed (1). Tests 8 passed (8). Duration 242ms. Started 2026-10-04 06:43:16 UTC.
The tests cover a partial catalog (one server ready, one still starting), a spurious
cancelledthat later becomesready, the idle fast path, a timeout that does not block the next turn, threadless notifications, thread isolation, andfailednot blocking.Tests 1 passed, 132 skipped (133). Duration 4.98s. Started 2026-10-04 06:43:35 UTC.
startTurnstill completes when no MCP startup status has been reported.Exit 0. Pre-existing Effect language-service suggestions only.
Limitations
The wait only includes servers that have already emitted
mcpServer/startupStatus/updatedwhen the turn samples the catalog. A firststartingevent that arrives after that sample can still miss that turn.A server that is still starting, or stuck on
cancelledwithout a laterready, is omitted after 30 seconds. Later turns do not wait for it again unless it reportsstartingagain.Not run against a live Codex app-server or the 10–20s stdio servers from the report.