fix(agent): widen MCP client-session timeout for cold first runs#338
Open
harshalmore31 wants to merge 1 commit into
Open
fix(agent): widen MCP client-session timeout for cold first runs#338harshalmore31 wants to merge 1 commit into
harshalmore31 wants to merge 1 commit into
Conversation
The openai-agent and deep-agent runners left MCP stdio client-session timeouts at the SDK / library defaults, so a heavy server's cold-cache first spawn (e.g. vibration importing scipy + numpy + DSP submodules) could exceed the budget and abort the entire agent run with McpError: Timed out ... Waited 5.0 seconds during session.initialize(). Plumb a 30s timeout through both runners. Warm handshakes are sub-second across all six servers so there is no operational downside. claude-agent is unaffected: its Python-side initialize timeout already defaults to 60s, and the stdio MCP servers it spawns are managed by the bundled Claude Code CLI subprocess. Closes IBM#335. Signed-off-by: harshalmore31 <harshalmore2468@gmail.com>
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.
Closes #335.
Summary
openai-agentrunner now passesclient_session_timeout_seconds=30toMCPServerStdio(...)(was the SDK default of 5s).deep-agentrunner now passessession_kwargs={"read_timeout_seconds": timedelta(seconds=30)}per connection._MCP_CLIENT_TIMEOUT_SECONDS = 30constant alongside_DEFAULT_MODEL.claude-agentis intentionally untouched — its Python-side initialize timeout already defaults to 60s, and the stdio MCP servers it spawns are managed by the bundled Claude Code CLI subprocess (no Python-side knob).Why 30s
Cold-cache first-spawn timings measured on a freshly synced env: vibration server ~12s (one-time, scipy + numpy + DSP submodule imports). Warm handshakes across all six servers: 0.26s–0.89s. 30s leaves substantial margin without making a genuinely misconfigured server feel slow to fail.
Test plan
uv run pytest src/agent/ -k "not integration"— 132/132 pass.uv run openai-agent --model-id gpt-4.1 "What is the current date and time?"— all 6 servers spawn cleanly, agent returns the expected answer.