1jehuang / 1jehuang/jcode

MCP server headroom connection timeout blocks first model call on every startup (30s delay)

Open
#617 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug needs-info priority: medium triage: unclear
Dominant language
Rust
Stars
19.9k
Forks
2.3k
Avg merge
2d 7h
Merged PRs (30d)
30

Description

Describe the bug

On every Jcode startup, the first model call is delayed by ~30 seconds because the MCP server headroom connection times out. The login message "MCP: advertised 14 cached tool(s) from 1 server(s) at spawn" appears, followed 30 seconds later by "Failed to connect to MCP server headroom: Request timeout: deadline has elapsed".

Steps to reproduce

  1. Start Jcode
  2. Observe that the first LLM call hangs for ~30 seconds
  3. Check logs: the MCP server headroom connection consistently times out

Expected behavior

Jcode should gracefully handle MCP server connection failures without blocking the first model call.

Actual behavior

Every startup shows this pattern:

[INFO] MCP: advertised 14 cached tool(s) from 1 server(s) at spawn
... 30 seconds later ...
[ERROR] Failed to connect to MCP server headroom: Request timeout

Occurrences today (7/7 restarts)

All 7 Jcode restarts today exhibited this 30s delay (timestamps from logs).

Environment

  • Jcode version: v0.60.0 (4f147a0c)
  • OS: Linux (Red Hat KVM, x86_64)
  • Provider: OpenRouter
  • MCP servers: headroom only

Suggested fix

  1. Non-blocking MCP init: first model call should not be blocked by MCP init
  2. Shorter default timeout: consider 5-10s with background retry
  3. Graceful degradation: log warning, don\t block user interaction

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Start by tracing MCP initialization and the first model-call path, then reproduce startup with the headroom server while checking the logged timeout. Done means an MCP connection failure no longer delays the first model call, while the failure is logged and can be retried in the background.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
ai, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.