#1143
CLI bridge does not report a local MCP server that dies after mcp.opened; calls burn the 120 s timeout
Symptom
If the local MCP server process on the device dies after the bridge has already sent mcp.opened for it (crash, OOM, the user kills it), the API-side session never learns. The next tool call sits until MCP_SESSION_CALL_TIMEOUT_SECONDS (120 s) and the user waits two minutes for a "timed out" error instead of an immediate "your <server> server exited".
Where
- CLI bridge:
packages/cli/src/commands/bridge/— the child-process lifecycle for a spawned MCP server. AfterMCP_OPENEDis sent (constants.ts:13), a childexit/errorneeds to be turned into anmcp.errorframe for thatsid(constants.ts:14). Today the frame is only emitted for failures during open. - API side already handles it correctly once the frame arrives:
apps/api/app/services/mcp/device_connector.py_drain_inboxtreats a mid-sessionmcp.erroras a read-stream failure and tears the session down (L153–158). No API change should be needed.
Expected
Child exits → bridge sends {"t":"mcp.error","sid":…,"error":"<server> exited with code N"} → the in-flight call fails immediately with that message, and the session is closed so the next call re-opens (or reports the server as unavailable) instead of reusing a dead one.
Notes
- Found while profiling
tests/integration/real/test_device_bridge_e2e.pyon the self-hosted CI box; the diagnosis is from reading the CLI bridge and connector code, not from a reproduced production incident. - Regression test: bridge e2e case that kills the spawned
server-everythingprocess mid-session and asserts the next call fails fast with the exit message. - Related: #1142 (device WebSocket drop leaves sessions hanging) — the transport-level twin of this bug.
Activity
0No activity yet.