fix(tui): surface the real turn-failure detail, not just the code#190
Open
arelchan wants to merge 1 commit into
Open
fix(tui): surface the real turn-failure detail, not just the code#190arelchan wants to merge 1 commit into
arelchan wants to merge 1 commit into
Conversation
TurnFailed carries the underlying error (error=str(exc)), but the spine sink dropped it: emit_error was called with a hardcoded turn_failed / internal, so every failed turn -- missing dependency, provider error, node issue -- collapsed to the same opaque 'error: turn_failed (code=-32099)' with no way to tell them apart. Thread the failure detail through: add an optional detail field to the error event payload (openrpc schema + regenerated types + pydantic model), pass TurnFailed.error into emit_error, and append the first line of it to the tui error line. reason/code/message stay unchanged, so the cancelled-by-client path and existing consumers are unaffected. Closes #114 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change description
Closes #114.
Every failed agent turn surfaces in the TUI as the same opaque line --
error: turn_failed (code=-32099)-- regardless of the real cause (a missing dependency, a provider error, a Node version problem, ...). That made #119 (missingorjson) impossible to diagnose from the UI and forced a from-scratch reproduction.Root cause:
TurnFailedalready carries the underlying error (error=str(exc)in the scheduler), but the spine sink discarded it --raven/tui_rpc/spine.pycalledemit_error(..., "turn_failed", "internal")with the detail hardcoded, soTurnFailed.errornever reached the wire or the UI.Fix
Thread the failure detail end to end:
ui-tui/rpc-schema/openrpc.json: add an optionaldetailstring to theErrorEventpayload (single source of truth).ui-tui/src/rpc/generated.ts: regenerated from the schema (npm run lint:rpcconfirms it is in sync).raven/tui_rpc/models.py: adddetail: str | None = NonetoErrorEventPayload.raven/tui_rpc/spine.py:emit_erroraccepts an optionaldetailand includes it only when non-empty; theTurnFailedsink passesevent.error.ui-tui/src/app/chatStream.ts:onErrorappends the first line ofdetail(capped) to the error line, so the user sees e.g.error: turn_failed (code=-32099): No module named 'orjson'.code/message/reasonare unchanged, so thecancelled_by_clientpath and existing consumers are unaffected;detailis omitted when empty (back-compat).Tests
tests/test_tui_rpc_spine.py:emit_errorwith a detail includes it in the payload; the existing no-detail test still asserts it is omitted.ui-tui/src/__tests__/chatStream.test.ts: an error event carryingdetailrenderserror: turn_failed (code=-32099): <detail>.Type of change
Checklists
Development
npm test)Code review