Repository navigation
fix(dsh): show the error a dsh turn ended on as a failed request, and a stopped turn as such - #3742
Conversation
… a stopped turn as such
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
Local merge gate: PASS
The Linux suites of the required checks (Fast checks, Integration and browser), run on main d40cecb with this PR's head eb8279d merged in (local merge 83c3884ed7ca, not pushed), as groups side by side in the self-hosted CI runner image on
Total 640s. |
Merge passMerged head
Two reviewers at this head: Claude (Opus) CLEAR, Codex Terra CLEAR. A dsh-tui turn that ended on an error showed nothing of why. The reader ( Left, none HIGH, not a regression (the lane is closed, so these stay here):
GitHub's run of this head was red on an integration test that timed out at 30 s under load (a relay test this PR does not touch); the merge pass gated the head on the new Reports: |
… failed request (#3749) ## Change When the API refuses a request (a rate limit, an overloaded model), Claude Code writes the error into its transcript as an assistant message whose text is the error, marked `isApiErrorMessage: true` (with `error` and `apiErrorStatus`). Ovis drew it as an ordinary answer, so a turn that failed read as if Claude had answered "API Error: …" (agent chat audit, Claude row C20). - `server/claude-transcript.ts`: the text of an entry marked `isApiErrorMessage` becomes the failed request part every reader already uses (`{ kind: "text", text, failed: true }`, as omp, pi, OmO, Codex (#3733) and dsh (#3742) write theirs), so Chat shows "Request failed" with Claude Code's own words, never as the answer or a final answer. Both the whole-page and incremental readers go through it. - Fixture `server/fixtures/claude-api-error-2.1.321.jsonl`: a 429 as Claude Code 2.1.321 recorded it on this PC, the error entry kept as written (folder and branch names replaced), the prompt before it shortened. Not in this PR: the sidebar status of such a turn, which is herdr's for Claude Code. ## Screenshots | | After | | --- | --- | | 390 |  | | 1280 |  | Before: the same turn rendered as an answer reading "API Error: Request rejected (429) …" (the audit's finding). After: `scripts/claude-api-error-qa.ts`: the fixture under an isolated HOME, a pane in an isolated herdr session reporting that Claude session, this branch's server and a browser at 1280 and 390. A live Claude run was not made: a cheap one cannot be made to fail without spending the owner's account into a rate limit. ## Validation - Failing first: `server/claude-api-error.test.ts` "shows the API error Claude Code recorded as a failed request" fails on main, passes after; "keeps an answer that only quotes an error" passes on both. - `HERDR_TEST_MODE=unit bun test ./server/claude-api-error.test.ts ./server/claude-incremental.test.ts`: pass. - `bun scripts/claude-api-error-qa.ts` (heavy queue, browser): pass. - `bun run check fast` (heavy queue): pass.
Change
A DeepSeek Harness (dsh-tui) turn that ended in a provider error showed in Chat only as a "Background result delivered" divider whose fold said "Turn ended: error", with the header and sidebar at DONE (agent lab re-run of the chat audit, row C20, seen live). dsh records the error with its own words on the turn's end,
turn/endreason: { kind: "error", error: { message, code, status } };server/dsh.tsdropped the message and pushed a notice with nosource, which ChatView names "Background result delivered".projectDsh: a turn that ended withreason.kind === "error"and a message gets the failed request part every reader already uses ({ kind: "text", text: "Error: …", failed: true }, as omp, pi, OmO and Codex write theirs), so Chat shows "Request failed" with dsh's words ("Insufficient Balance (request_id: …)"). Any other end that is notcompleted(a turn the user stopped) keeps its notice, now withsource: "dsh-turn-end", so it reads "Turn ended: aborted" instead of "Background result delivered".server/fixtures/dsh-tui-0.19.0-dsh-0.2.2-rc.1-error.jsonl: a real dsh-tui session from the agent lab, its DeepSeek route at no balance, with system prompts and tool lists left out (every record kept, soseqstays whole).Not in this PR: the sidebar still reads DONE for such a turn. Its status is herdr's for dsh-tui; a rest from dsh's own record, as #3733 does for Codex, is a follow-up.
Lane chat-errors (#3729 the reason a conversation cannot be read, #3733 Codex failed turns, #3738 sends the agent never records).
Screenshots
After: a real run. The lab's dsh-tui 0.19.0 (its own HOME, keys and packages; it installs nothing without
/update) resumed its recorded session in an isolated herdr session, read by this branch's server under the lab's HOME; no model call was made./api/pane/conversationansweredsource: "dsh-transcript"with the failed partError: Insufficient Balance (request_id: ef4dff0b-…). (The row is folded here; #3733 opens a failed row that ends its turn.)Validation
server/dsh.test.ts"shows a turn that failed before any reply with the error dsh recorded", "shows the error a recorded dsh-tui turn ended on" (the fixture) and "names a turn stopped by the user as such" fail on main, pass after.HERDR_TEST_MODE=unit bun test ./server/dsh.test.ts ./server/dsh-http.test.ts: pass.bun run check fast(through the heavy queue): pass.