Skip to content

fix(dsh): show the error a dsh turn ended on as a failed request, and a stopped turn as such - #3742

Merged
devswha merged 1 commit into
mainfrom
fix/dsh-failed-turn
Nov 12, 2026
Merged

devswha merged 1 commit into
mainfrom
fix/dsh-failed-turn

Conversation

@devswha

@devswha devswha commented Nov 12, 2026

Copy link
Copy Markdown
Owner

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/end reason: { kind: "error", error: { message, code, status } }; server/dsh.ts dropped the message and pushed a notice with no source, which ChatView names "Background result delivered".

  • projectDsh: a turn that ended with reason.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 not completed (a turn the user stopped) keeps its notice, now with source: "dsh-turn-end", so it reads "Turn ended: aborted" instead of "Background result delivered".
  • Fixture 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, so seq stays 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

Before (main, agent lab) After
390 before after
1280 after

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/conversation answered source: "dsh-transcript" with the failed part Error: Insufficient Balance (request_id: ef4dff0b-…). (The row is folded here; #3733 opens a failed row that ends its turn.)

Validation

  • Failing first: 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.
  • Live run above: pass.
  • bun run check fast (through the heavy queue): pass.

@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • Provider errors, including quota and rate-limit issues, now appear beneath the relevant chat message as failed requests instead of as background-result notices.
    • Other interrupted turns display a “Turn ended: aborted” notice.
    • A provider error in one turn no longer changes how subsequent turns are displayed.

projectDsh now maps non-completed turns with provider error messages to failed assistant text. Other non-completed endings produce sourced notices. Tests, a recorded transcript, and the changelog cover these results.

Changes: DeepSeek Harness failed turns

Layer / File(s) Summary
Turn-ending projection
server/dsh.ts
projectDsh represents non-completed turns with error messages as failed assistant text. Other endings produce notices tagged with dsh-turn-end.
Turn-ending tests and documentation
server/dsh.test.ts, server/fixtures/dsh-tui-0.19.0-dsh-0.2.2-rc.1-error.jsonl, changelog.d/dsh-failed-turn.md
Tests and the fixture cover provider errors and aborted turns. The fixture also records model changes, a user question, and failed workspace-write attempts. The changelog documents the displayed messages.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related PRs

  • devswha/ovis#2453: Adds projectDsh and the transcript reader whose turn-ending mapping this change updates.

Suggested reviewers: jokkopucko

Merge Risk: Minimal · up to eb827

Provider-error turns now show the recorded error as a failed request, and user-stopped turns are labeled as aborted. No actionable merge-blocking risk was identified. The sidebar status is a known follow-up and is not in scope.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main behavior change: a turn that ended on a provider error now shows as a failed request, and a stopped turn is labeled as stopped. It matches the changeset in server/dsh.ts and t…
Description check Passed The description follows the template. The Change section explains the problem (provider-error turns shown as a background divider with the wrong status), the resulting behavior, and the scope limit (s…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main behavior change: a turn that ended on a provider error now shows as a failed request, and a stopped turn is labeled as stopped. It matches the changeset in server/dsh.ts and the tests. It is specific, but it lists two changes and uses a long phrase.

Full details: Description check

Explanation

The description follows the template. The Change section explains the problem (provider-error turns shown as a background divider with the wrong status), the resulting behavior, and the scope limit (sidebar still shows DONE, deferred to a follow-up). The Validation section lists the failing-first tests, the unit test command, the live run, and the fast check. It does not explicitly say which checks were skipped, and it does not state the contract-test coverage the template asks for on HTTP/WS changes. It also does not link a maintainer-agreed issue, though the template asks for that only for features. Those gaps are minor.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between aea3fdf and eb8279d.

Files selected for processing: 4

  • changelog.d/dsh-failed-turn.md
  • server/dsh.test.ts
  • server/dsh.ts
  • server/fixtures/dsh-tui-0.19.0-dsh-0.2.2-rc.1-error.jsonl

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

@devswha

devswha commented Nov 12, 2026

Copy link
Copy Markdown
Owner Author

Local merge gate: PASS

Local merge gate: PASS #3742 merge=83c3884ed7ca head=eb8279d8f6b8 main=d40cecb08d72 on herdr-ci-runner:local on devswha-ThinkStation-P620 CPUs 64-127 in 640s, reruns=0

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 herdr-ci-runner:local on devswha-ThinkStation-P620 CPUs 64-127 (29% busy before the start, host load 43.54; shards=4 unit_workers=8 browser_main_workers=2 browser_other_workers=16). Scope: full. Native Windows install and the macOS checks are not part of this gate.

Step Command Result Seconds Counts
fast-install bun install --frozen-lockfile pass 0 -
release-guards bun scripts/release-guards.ts --base d40cecb08d72 pass 0 -
fast bun run check fast pass 242 tests 16417 pass / 0 fail; check steps 6 ok / 0 failed
integration-install bun install --frozen-lockfile pass 0 -
integration bun run check integration pass 253 tests 1424 pass / 0 fail; check steps 3 ok / 0 failed
browser-main-install bun install --frozen-lockfile pass 0 -
browser-main-build bun run build pass 20 -
browser-main BROWSER_SCRIPTS=ui-regression,ui-contexts-regression bun run check run -- bun scripts/ci-browser-parallel.ts pass 392 browser scripts 2/2 passed
browser-other-install bun install --frozen-lockfile pass 0 -
browser-other-build bun run build && bun run build:shell pass 28 -
browser-other BROWSER_EXCLUDE=<those two> bun run check run -- bun scripts/ci-browser-parallel.ts pass 603 browser scripts 205/205 passed

Total 640s.

@devswha
devswha merged commit 0e69c4d into main Nov 12, 2026
19 of 21 checks passed
@devswha

devswha commented Nov 12, 2026

Copy link
Copy Markdown
Owner Author

Merge pass

Merged head eb8279d8f6b8 as 0e69c4d381aa on the local merge gate, with no unresolved review threads.

Reviewer Verdict Note
claude CLEAR
codex CLEAR

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 (server/dsh.ts) now gives the error the turn ended on as a failed request, in the provider's own words, and marks a turn the user stopped; it uses fields shared/protocol.ts already has, so no HTTP or WS change. server/dsh.test.ts passes 42 of 42; with main's server/dsh.ts exactly the three new tests fail.

Left, none HIGH, not a regression (the lane is closed, so these stay here):

  • MEDIUM (both, traced): a turn the user stopped still folds everything the agent wrote before the stop behind the notice (ChatView.tsx:1299 draws a turn holding a notice as one folded divider), as on main; the new test builds that case and checks only the last part. Putting the end-of-turn notice in a turn of its own would show the partial reply.
  • LOW (Claude, read): the stopped-turn label is the server's English "Turn ended: aborted" in every locale; the new fixture holds home-directory paths (no keys or tokens).

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 main with the local merge gate (its comment has the result).

Reports: ~/.cache/ovis-tmp/reports/pr-3742-eb8279d8-*.report.md.

@devswha
devswha deleted the fix/dsh-failed-turn branch November 12, 2026 13:03
devswha added a commit that referenced this pull request Nov 12, 2026
… 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 |
![after](https://raw.githubusercontent.com/devswha/ovis/19b619c46487622ef9d872c4d143f8580f6c1513/after-390.png)
|
| 1280 |
![after](https://raw.githubusercontent.com/devswha/ovis/19b619c46487622ef9d872c4d143f8580f6c1513/after-1280.png)
|

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant