Skip to content

Widget: fix the widget-side review findings of #566 - #570

Merged
neuromechanist merged 7 commits into
developfrom
fix/release-0.8.16-widget-followups
Sep 30, 2026
Merged

neuromechanist merged 7 commits into
developfrom
fix/release-0.8.16-widget-followups

Conversation

@neuromechanist

Copy link
Copy Markdown
Member

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. Only frontend/ changed.

What changed

  • 1. Warnings no longer replace each other. The banner holds one line per warning, each with its own 10 s timer; identical text restarts the one line; the banner hides with the last line.
  • 2. A cut-off reply is marked in place. A warning before done with code: cut_off (or, with no code, the server's wording) sets a cutOff mark 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 as true.
  • 3. A failed request keeps its banner and the question. The banner stays until dismissed or the next send, with selectable text, the 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.
  • 4. The non-streamed fallback shows data.warnings (strings or {message, code}), through the same function as a stream's warning events, including the mark.
  • 5. A server error containing "timeout" is shown as sent. The error raised for an error event is marked serverReported; 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".
  • 6. A cut-off reply with no text and no run record is kept. applyDoneEvent kept an empty reply only with entries in executions, but answerToolRequest records only code that ran, so a reply whose only run was get_full_output had none and the bubble was dropped (the server sends a warning and an empty done for 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

  • Notes the widget already wrote into replies (_[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.
  • The client-side 60 s stream timeout check only runs between chunks, so a silent stream does not reach it. Out of scope; behavior unchanged.

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.js and frontend/test-streaming.js). The tests read the server's messages from src/api/turn_outcome.py, so the widget's wording fallback cannot drift from them.

  • Every step of the Frontend Tests job, run locally under Bun 1.4.2 (the pinned version): all pass, including the runtime bundle check.
  • uv run pytest tests/test_frontend -q -p no:cacheprovider --color=no --no-cov (after uv sync --frozen --extra dev; no Python test was added or changed): 112 passed.
  • Every Chrome check in test.yml ran locally in headless Chrome and passed: color scheme, first paint, launcher geometry, pop-out, paced reveal, activity status, and chrome.js.
  • The new banners checked by eye in headless Chrome, light and dark: stacked warnings, the italic note, the error banner with its reference and buttons, the restored question.
  • Not run: CI itself.

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.
@github-actions

Copy link
Copy Markdown
Contributor

Preview Deployment

Name Link
Preview URL https://fix-release-0.8.16-widget-fo-demo.osc.earth
Branch fix/release-0.8.16-widget-followups
Commit c326ba2

This preview will be updated automatically when you push new commits.

@neuromechanist
neuromechanist merged commit 40e8284 into develop Sep 30, 2026
8 checks passed
@neuromechanist
neuromechanist deleted the fix/release-0.8.16-widget-followups branch September 30, 2026 23:00
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