fix(chat): surface real backend errors instead of the canned empty-response hint - #125
Open
sergiomaldo wants to merge 1 commit into
Open
fix(chat): surface real backend errors instead of the canned empty-response hint#125sergiomaldo wants to merge 1 commit into
sergiomaldo wants to merge 1 commit into
Conversation
…sponse hint
Error frames and api error envelopes carry a code + human message, but the
UI dropped the code and, in errored-empty turns, showed the misleading
'model returned an empty response' hint. Now:
- ChatMessage gains errorCode; setError/applyFrame propagate the SSE error
frame's code, and the non-2xx POST path parses the FastAPI detail envelope
({code, message} or plain string) for ANY status, not just 400
- the generic network-failure catch keeps the underlying message visible
- Message.svelte renders '[code] message' in the existing error styling, also
for a done-but-errored empty turn, and only shows the canned empty-response
hint when a stream genuinely completed with no error and no content
- retry/decide clear errorCode along with error
Co-Authored-By: Claude Fable 5 <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.
Problem
When the backend refuses or fails a chat completion, the web UI either shows nothing or misdiagnoses it:
tier_below_minimumfrom a skill-declared tier floor) renders no error bubble and no toast — the send arrow greys out and the composer just sits there. The user cannot distinguish "slow local inference" from "request refused", even though the 403 body carries an actionable message ("Pick a model with an equal or lower-numbered tier, or relax the floor").Repro: attach a skill whose tier floor exceeds the selected model's tier and send a message; or trigger any non-400 api error on send.
Fix
ChatMessagegainserrorCode;setError/applyFramepropagate the SSE error frame's code, and the non-2xx POST path parses the FastAPI detail envelope ({code, message}or plain string) for any status, not just 400.Message.svelterenders[code] messagein the existing error styling, including for a done-but-errored empty turn; the canned empty-response hint now only appears when a stream genuinely completed with no error and no content.errorCodealong witherror.Tests
New cases in
chatStream.svelte.test.ts(error-frame code propagation, non-2xx envelope parsing for multiple statuses, network-failure message) andMessage.svelte.test.ts(code+message rendering, errored empty turn, canned hint only on genuine empty success).Provenance
Found operating a production self-hosted legal deployment (a law firm running Donna v0.6.2 fully local).
CI note:
prettier --checkcurrently fails onmainitself (docs/superpowers/HANDOFF-v0.6.2-release.md); #122 fixes it, so this branch's lint job goes green once that lands.svelte-check,eslint, and vitest all pass on this branch.🤖 Generated with Claude Code