Repository navigation
Widget: fix the widget-side review findings of #566 - #570
Merged
Merged
Conversation
showWarning wrote every warning into one text node, so a cut-off notice and the long-conversation notice that follows it were never both readable. Each warning is now its own line with its own 10 s timer; the banner hides with the last line; identical text restarts the one line's timer. Tested: new cases in frontend/test-widget-paced-streaming.js (failed before the change); bun frontend/test-widget-color-scheme.js unchanged.
When a warning arrives before done and says the reply was cut off (code cut_off when the server sends one, else the server's wording), the reply gets a cutOff mark. The message draws the existing italic 'Response may be incomplete' note from that mark once its text is fully shown, so the done event's canonical text does not replace it. The mark is saved with the conversation and read back only as a boolean. Tested: new cases in frontend/test-widget-paced-streaming.js (failed before the change), including a saved-and-reloaded conversation.
applyDoneEvent kept an empty reply only if it had entries in executions, but answerToolRequest records only code that ran, so a reply whose only run was get_full_output had none. The server sends a warning and a done with empty content for it (the run counts as code there), and the bubble was dropped, leaving the 10 s banner as the only explanation. A reply marked cutOff is now kept and draws the explanation the mark carries. Tested: frontend/test-streaming.js and frontend/test-widget-paced-streaming.js (new cases failed before the change).
The non-streamed fallback ignored data.warnings, so a cut-off answer arrived unmarked. Warnings (strings, or objects with a message and an optional code) now go through the same function as a stream's warning events: the banner, and the cutOff mark on the reply, which is saved with it. A missing or malformed field is ignored. Tested: new cases in frontend/test-widget-paced-streaming.js (failed before the change).
A backend error event whose text contained 'timeout' was rewritten to 'Stream timeout' in the reply when partial text was visible, and one that contained 'JSON' became 'Invalid response from server' in the banner. The error raised for an error event is now marked serverReported, and both handlers pass it through as sent before looking for failures of the stream or the page. A client-side stream failure that says timeout still reads as one. Tested: new cases in frontend/test-widget-paced-streaming.js (failed before the change).
…the error id The banner for a failed chat request lasted 5 s, and when the reply was empty (the routine no-answer error) the question was removed with it, so the reader lost both. Now, for a failed request: - the banner stays until dismissed or the next send, with a dismiss button, selectable text, and the server's error_id (when the event carries one) as text with a copy button (falling back to selecting it where the page cannot copy); - the question goes back in the input when the failure removed it from the conversation; an error after a partial reply keeps it there, as before; - an earlier message's timer no longer hides a later message's banner. Other banners (settings, feedback, storage) still go after 5 s. Tested: new cases in frontend/test-widget-paced-streaming.js (failed before the change); every frontend suite in the Frontend Tests job run locally.
#568 gives each warning a code and sends one combined notice (code cut_off, codes listing both) when a cut-off and a long conversation coincide, and adds a context-window cut-off whose message is 'stopped short because' and whose advice is to start a new conversation, not to ask it to continue. So: - the wording fallback for a warning with no code (a stream before #568, and a non-streamed response's warnings, which are strings) also reads that message; - the note under a cut-off reply's text says only that it was cut off, true for either cause; a reply with no text shows the server's own message for it, kept on the reply (bounded, saved and read back only as a string), so the advice is the server's and survives a reload; - tests read the server's message constants from src/api/turn_outcome.py. Tested: bun frontend/test-widget-paced-streaming.js.
Contributor
Preview Deployment
This preview will be updated automatically when you push new commits. |
8 tasks
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.
Widget-side fixes for the review of #566, written against the warning and error contract that #568 merged (
code,codes,error_id,request_id). Each field is feature-detected, so the widget also works with a server that sends none of them. Onlyfrontend/changed.What changed
warningbeforedonewithcode: cut_off(or, with no code, the server's wording) sets acutOffmark on that reply. The reply draws the italic "Response may be incomplete" note from the mark once its text is fully shown. The mark is saved with the conversation and read back only astrue.error_id(when sent) as text with a copy button, and a dismiss button. When the failure removed the question from the conversation, it goes back in the input. Other banners (settings, feedback, storage) still go after 5 s. An earlier message's timer no longer hides a later banner.data.warnings(strings or{message, code}), through the same function as a stream'swarningevents, including the mark.errorevent is markedserverReported; both handlers pass it through before looking for failures of the stream or the page. This also stops a server message containing "JSON" from becoming "Invalid response from server" in the banner. A client stream failure that says timeout still reads "Stream timeout".applyDoneEventkept an empty reply only with entries inexecutions, butanswerToolRequestrecords only code that ran, so a reply whose only run wasget_full_outputhad none and the bubble was dropped (the server sends a warning and an emptydonefor it). A marked reply is now kept and shows the server's own explanation, which is saved, so a reload shows it too.The note under a reply's text is generic ("the reply was cut off") because #568's context-window cut-off advises starting a new conversation, not asking it to continue.
Not changed
_[Error: ...]_,_[Stream interrupted]_) show their underscores as typed, because the markdown renderer reads*...*and not_..._. The new note uses*...*so it renders in italics. Left as is: out of scope, and existing tests assert the current text.Testing
Each behavior item had a failing test before its fix (a new test file would not run in CI, so the cases are in
frontend/test-widget-paced-streaming.jsandfrontend/test-streaming.js). The tests read the server's messages fromsrc/api/turn_outcome.py, so the widget's wording fallback cannot drift from them.uv run pytest tests/test_frontend -q -p no:cacheprovider --color=no --no-cov(afteruv sync --frozen --extra dev; no Python test was added or changed): 112 passed.test.ymlran locally in headless Chrome and passed: color scheme, first paint, launcher geometry, pop-out, paced reveal, activity status, andchrome.js.