Problem
Long-running MCP tool calls can remain silent until the final tool result is ready. In the real Mac mini production path through Cloudflare Tunnel, several successful /mcp requests completed near the apparent client timeout boundary:
- 12,023 ms
- 11,663 ms
- 9,096 ms
- 12,027 ms
The host UI can remain at “Waiting for a tool result” and then report that sending the message timed out, even though DevSpace and the tunnel remain healthy.
Current diagnosis
The modern MCP handler uses its default response mode, so an ordinary tool call may not establish SSE before the result completes. exec_command waits 10 seconds by default and permits a 12-second yield window. This creates a long time-to-first-byte window that is close to the observed client timeout.
Current request logging is completion-only, which makes a stuck or client-aborted request invisible. Aggregate narrow-tool calls also log their internal child calls without a parent identifier, and a batch with running children can currently be logged as successful.
Proposed scope
- Establish the OpenAI-facing modern MCP response as SSE and emit periodic keepalive traffic.
- Reduce the default process yield window to 3 seconds while retaining the existing explicit maximum.
- Add request lifecycle observability for request start, first byte or stream establishment, completion, and client abort.
- Make aggregate/child tool-call relationships and running outcomes unambiguous in logs.
- Add regression coverage for time-to-first-byte, long-running command session return, request abort, and aggregate logging semantics.
Acceptance
- A silent command longer than the default yield returns a running process session within the client-safe window.
- The public MCP transport establishes a streaming response promptly and keeps it active during long work.
- Client disconnects are visible in logs and do not appear as successful completion.
- Running aggregate operations are not reported as terminal success.
- Existing MCP compatibility, process-session, typecheck, tests, and build remain green.
Non-goals
- Changing Cloudflare Tunnel ownership or configuration.
- Auto-cancelling every detached process without an explicit lifecycle policy.
- Broad redesign of all long-running tools in this patch.
Problem
Long-running MCP tool calls can remain silent until the final tool result is ready. In the real Mac mini production path through Cloudflare Tunnel, several successful
/mcprequests completed near the apparent client timeout boundary:The host UI can remain at “Waiting for a tool result” and then report that sending the message timed out, even though DevSpace and the tunnel remain healthy.
Current diagnosis
The modern MCP handler uses its default response mode, so an ordinary tool call may not establish SSE before the result completes.
exec_commandwaits 10 seconds by default and permits a 12-second yield window. This creates a long time-to-first-byte window that is close to the observed client timeout.Current request logging is completion-only, which makes a stuck or client-aborted request invisible. Aggregate narrow-tool calls also log their internal child calls without a parent identifier, and a batch with running children can currently be logged as successful.
Proposed scope
Acceptance
Non-goals