A chat turn that fails before streaming never surfaces an error — the UI hangs to a generic connection timeout
Summary
When a chat turn fails before the provider produces any stream (e.g. the provider probe fails), no error event reaches the frontend — the user stares at an idle chat until the client's own ~2-minute timeout shows "No response from the agent after 2 minutes. Try again or check your connection."
Problem
What happened vs expected: web_chat logged run_chat_task failed … [claude-code] \claude` CLI not installedandreport_errorfired at11:42:46— the backend knew the turn was dead within milliseconds. The UI was never told: nochat_error-style socket event was emitted for the turn (an external_transfer_pendingegress event did go out, but nothing terminal). Expected: an immediate, actionable error bubble ("Claude Code CLI not found — …") the momentrun_chat_task` fails.
The "check your connection" copy is also misleading — the failure was local and permanent, not connectivity.
Steps to reproduce:
- Configure the claude-code provider and make the CLI unresolvable (e.g. launch from Finder with the CLI only in
~/.local/bin— see the companion issue — or temporarily rename the binary). - Send a message.
- Backend log shows
run_chat_task failedinstantly; the chat UI shows a spinner/typing state for ~2 minutes, then a generic connection error.
Version/platform: v0.63.14, macOS (Darwin 25.3.0), desktop bundle.
Solution (optional)
Emit a terminal per-turn error event on the socket surface from the run_chat_task failure path (src/openhuman/web_chat/ops.rs — the same place that logs the WRN), carrying the provider's error string; frontend renders it as the turn's result. The 2-minute client timeout then remains a true last resort for transport loss only.
Acceptance criteria
- [ ] Repro gone — a provider failure surfaces in the chat within ~1s with the provider's actual error message.
- [ ] Regression safety — a test covers "run_chat_task error ⇒ terminal error event emitted for that turn".
- [ ] Diff coverage ≥ 80% — the fix PR meets the changed-lines coverage gate (Vitest + cargo-llvm-cov, enforced by
.github/workflows/ci-lite.yml).
Related
Companion issue: Finder-launch CLI resolution (the failure that exposed this); its fix removes this particular trigger but not the gap.
Triage: valid — Current review confirms this is a concrete, in-scope engineering issue or request: “A chat turn that fails before streaming never surfaces an error — the UI hangs to a generic connection timeout”. No complete resolution is evident in current main.
I looked into this against current main. The backend side of the requested fix is already in place. The remaining gap is on the UI side, and I haven't been able to pin it down yet.
What exists today
- When
run_chat_taskreturns an error,crates/openhuman-core/src/web_chat/ops/start_chat.rsbuilds a classifiedchat_errorevent for that thread and request (line 605) and publishes it after the turn slot is released (line 659). This code predates v0.63.14. It is older than the version in this report, so the problem wasn't simply a missing emit. app/src/providers/ChatRuntimeProvider.tsx(onError, around line 1778) turnschat_errorinto an assistant error message.
What is still unresolved
app/test/playwright/specs/chat-pre-stream-failure.spec.ts:183reproduces a pre-stream failure (a 400 on/chat/completions) and is currently skipped under #6388 because the turn still falls through to the watchdog.- That spec checks for the composer send banner (
[data-chat-send-error-code], line 117). Provider errors fromchat_errorrender as an assistant error bubble, not as that banner. So the skip may hide either of two cases: (a) the error is shown, and the spec is looking at the wrong element, or (b) thechat_errornever reaches this client. Case (b) matches what you observed, and possible causes are client-id routing or the event arriving before the frontend registers the turn.
What a real fix needs
- Run the skipped scenario and record whether a
chat_errorreaches the socket for that request id, and whether an assistant error bubble appears. - If it arrives and renders, assert on the bubble in the spec, remove the skip, and close this together with #6388.
- If it doesn't arrive, trace why between
publish_web_channel_eventand the socket for that client. Then add a regression test for "an error thatrun_chat_taskreturns before streaming produces a visible error for that turn within a few seconds".
Separately, the watchdog wording ("check your connection") is still misleading for local, permanent failures.
Leaving this open. #6388 tracks the same gap from the test side.