Skip to content

fix: bump context-server request timeout from 60s to 180s - #47

Merged
lukemarsden merged 1 commit into
mainfrom
fix/bump-context-server-timeout
Apr 26, 2026
Merged

fix: bump context-server request timeout from 60s to 180s#47
lukemarsden merged 1 commit into
mainfrom
fix/bump-context-server-timeout

Conversation

@lukemarsden

Copy link
Copy Markdown

Summary

Bumps DEFAULT_REQUEST_TIMEOUT in crates/context_server/src/client.rs from 60s to 180s. Documents the change in portingguide.md (new Critical Fix #10, plus an entry under Modified Upstream Files).

Problem

In a cold-start spec-task container, three Context server request timeout errors fire at the same instant — exactly 60s after Zed startup. All three context_servers are marked failed and their tools never appear for the session. Model reports:

<tool_use_error>Error: No such tool available: mcp__chrome-devtools__navigate_page</tool_use_error>

Why all three trip together:

  • chrome-devtools and github are npx <pkg>@latest — first run does an npm download
  • helixos is HTTP, but the local Helix API container is still warming up
  • All three initialize requests fire in parallel during Zed boot, while CPU is contended by Zed itself, settings-sync-daemon, language servers, etc.

Reproduced in ubuntu-external-01kq5h23dvkqzqy2jmxch8hgb2. Zed.log (timestamps trimmed):

20:09:59  zed starting
20:10:59  ERROR cancelled csp request task for "initialize" id 0 which took over 60s
20:10:59  ERROR chrome-devtools context server failed to start: Context server request timeout
20:10:59  ERROR github context server failed to start: Context server request timeout
20:10:59  ERROR helixos context server failed to start: Context server request timeout

User confirmed that toggling the server off/on in Zed settings fixes it (npm has cached the package by then) — but that's a manual workaround they shouldn't need.

Fix

-const DEFAULT_REQUEST_TIMEOUT: Duration = Duration::from_secs(60);
+const DEFAULT_REQUEST_TIMEOUT: Duration = Duration::from_secs(180);

Why 180s

Cold-start npx chrome-devtools-mcp@latest on a contended container is typically 60–90s. 180s gives ~2x headroom without making genuine failures noticeably slower to surface.

Why not per-server request_timeout in settings

ContextServerSettings has no request_timeout field upstream. Adding one would touch the settings schema, the project store, and ContextServer::new_with_timeout constructor — much larger change. The constant bump is one line and benefits every MCP uniformly.

Test plan

  • Build, deploy to spec-task container, start fresh task, verify mcp__chrome-devtools__list_pages works on first try (no toggling)
  • Verify Zed.log no longer shows cancelled csp request task for "initialize" / Context server request timeout errors at startup
  • CI green

🤖 Generated with Claude Code

In our spec-task containers, several stdio MCPs (chrome-devtools, github)
are configured with `npx <pkg>@latest` and an HTTP MCP (helixos) points at
a still-warming-up local API container. On a cold container start they all
attempt their JSON-RPC `initialize` handshake at the same instant Zed boots.
With Zed startup competing for CPU against settings-sync-daemon, language
servers, etc., and `npx` doing an npm download on first run, the handshake
routinely exceeds upstream's 60s `DEFAULT_REQUEST_TIMEOUT`. Three
`Context server request timeout` errors fire at the same instant, all three
context_servers are marked failed, and their tools never appear for the
session — most visibly:

  <tool_use_error>Error: No such tool available:
  mcp__chrome-devtools__navigate_page</tool_use_error>

Toggling the server off/on in Zed settings appears to fix it because by
then npm has cached the package and the second initialize completes in
well under 5s — but that's a manual workaround the user should not need.

Bump to 180s. Cold-start `npx chrome-devtools-mcp@latest` is ~60–90s on a
contended container, so 180s gives ~2x headroom. Genuine failures are still
visible in the UI within a minute or two; this is much better than silently
losing tools.

Per-server `request_timeout` in `ContextServerSettings` would be the more
elegant fix but it doesn't exist upstream — schema, project store, and
`ContextServer::new_with_timeout` would all need touching. The constant
bump is one line.

Updates portingguide.md (Critical Fix #10 + Modified Upstream Files).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@lukemarsden
lukemarsden merged commit f5fab97 into main Apr 26, 2026
23 of 24 checks passed
lukemarsden added a commit to helixml/helix that referenced this pull request Apr 26, 2026
Replaces the unmerged branch commit with the merge commit on Zed main
after helixml/zed#47 landed.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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