🤖 fix: add MCP server startup timeout and surface failures#2786
🤖 fix: add MCP server startup timeout and surface failures#2786ibetitsmike wants to merge 9 commits intomainfrom
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6ab14a2970
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: df5be4e517
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review Addressed: reverted the stdio exec timeout back to 24h (process lifetime), since startup timeout is already handled by the Promise.race wrapper in startSingleServer. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 70144207cd
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review Addressed: added AbortController to startSingleServer so timed-out startups now abort the in-flight impl and clean up spawned processes. Both stdio and HTTP/SSE paths have abort listeners that close transports/clients on timeout. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e70d79d00b
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review Addressed: token recount after MCP warning prepend. Uses |
Summary
Misconfigured MCP servers (e.g., wrong
command+argsformat) causestartSingleServer()to hang indefinitely oncreateMCPClient()/client.tools(), blocking the entire chat stream. This adds a 60s startup timeout and surfaces failures to the user via a system message warning.Background
startSingleServer()awaits MCP client creation with no timeout — a broken server config hangs foreverrunServerTest()(settings "Test" button) already has aPromise.racetimeout, but the production startup path did notImplementation
Startup timeout (
mcpServerManager.ts):MCP_STARTUP_TIMEOUT_MS = 60_000constantstartSingleServer→startSingleServerImpl, wrapped withPromise.racetimeout following the existingrunMCPToolWithDeadlinepattern (cleanup viaclearTimeout+.unref())Failure tracking (
mcpServerManager.ts):startServers()now returns{ instances, failedServerNames }MCPWorkspaceStatsextended withfailedServerNames: string[]getToolsForWorkspace()updated to propagate failuresUser-facing warning (
aiService.ts):Generated with
mux• Model:anthropic:claude-opus-4-6• Thinking:xhigh• Cost:$4.32