Repository navigation
Widget: reveal streamed text at a reading pace, code blocks whole - #533
Merged
Merged
Conversation
Refs #531. Luna at max effort thinks silently, then emits over 1000 chars/s, so a fine stream read as everything at once. The widget now paces the delivered text (300 chars/s floor, catch-up within ~1.5 s), shows fenced code whole, and skips pacing under prefers-reduced-motion. Tested with the new frontend suite in the next commit.
Refs #531. 68 checks; broken three ways (code paced, no reveal, no floor) and each is caught. Wired into test.yml and tests.yml.
Contributor
Preview Deployment
This preview will be updated automatically when you push new commits. |
…eep the reader's place Refs #531, review findings. Unpaced mode redrew per chunk (the 100 ms throttle was gone): now one redraw per tick. A redraw that threw inside a timer left the stream promise pending and the input disabled: the controller now catches it, releases waiters and check() rethrows it. Also: sources appear with their marker, no redraw over a focused textarea, no scroll yank for a reader who scrolled up, a reveal never ends inside [n] or a surrogate pair, and a hidden tab or page hide flushes the reveal so the reply is shown and saved.
…es, focus, scroll, page hide Refs #531. 112 checks; each new behavior broken once and caught (the throwing redraw by a crash with exit 1).
This was referenced Sep 29, 2026
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.
Closes #531.
The problem
GPT-6 Luna at maximum effort reads as "not streaming" in the widget. Measured through the real graph on dev NWB: the server does stream (300 to 380 small
contentevents), but Luna reasons silently for about 25 s of a 26 s turn and then emits over 1,000 characters per second, so a 1,500 character answer arrives in 1.4 s. The widget drew each chunk as it arrived, so the reader saw nothing, then everything.What this does
The widget now shows the text a reply has delivered at a reading pace instead of the pace the model happens to emit it:
[n]citation marker, and never inside a surrogate pair;prefers-reduced-motiongets every chunk on arrival, gathered into one redraw per tick;[n]marker has been shown;doneand a parked browser call wait for it (at most 4 s) before the canonical text replaces the streamed text; an error, a dropped connection and a thrown failure stop it at once and keep what arrived.This is the widget only; nothing on the server changes, so it applies to every community and every model, Claude included. Replaying a Luna-shaped burst through the widget (1,496 characters delivered in about 0.9 s): 25% on screen at 0.96 s, 50% at 1.5 s, 100% at 3.6 s.
Testing
frontend/test-widget-paced-streaming.js(112 checks; added totest.ymlandtests.yml):Each behavior was broken once to see the tests notice (code paced like text, no reveal, no floor, a redraw per unpaced chunk, an uncaught redraw error, sources ahead of text, a rebuilt textarea, a scroll yank, no flush on page hide, a cut marker): each fails the relevant checks. All other widget suites (
test-widget-*,test-streaming,test-markdown,test-citation-markers) pass unchanged, and the frontend parity and drift tests pass.Not verified
Nothing here ran in a real browser against the real service; the timings above are from the real widget code in happy-dom. Worth a look on the dev demo (https://develop-demo.osc.earth) after the dev deploy, with an NWB question (Luna) and a NEMAR one.
Review
An independent review found no critical defect and these, all addressed with a test that fails without the fix:
check().donetext that differs from the streamed text) and two tight timing bounds.[12]marker or an emoji in half in text with no spaces.done, so leaving the page in that window lost the reply.