Repository navigation
Hold unfinished inline markup while a message streams - #13
Merged
Merged
Conversation
An open message rendered as it stood showed markup that was not finished yet as literal text: a backtick waiting for its pair, `[text](url` before the `)`, `**` before its closer, a table header before its delimiter row. A moment later the markup closed and those characters were taken back, so the line flickered as it streamed. `StreamHold` finds where unfinished markup starts on the open line and the renderer shows the text before it, then the rest once the markup closes, the line ends or the message is finalized. Shown text never shrinks. Each update scans only the lines completed since the last one and the open line. Across 246 real agent answers streamed three characters at a time, text taken back on screen falls from 1,848 updates (164 answers) to 8, all in one answer that defines footnotes. Co-Authored-By: ace <bot@acehq.dev>
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
An open message (
finalized: false) rendered as it stood shows markup that isn't finished yet as literal text, then takes it back once the markup closes:`rm -Rshows a backtick, then becomes a code span;[the notes](https://exashows brackets and a linked URL, then collapses tothe notes;**bold,$x^2,<https://…show their markers;| a | b |paragraph until its delimiter row lands;1,--or``shows as text before it becomes a list item, a rule or a fence;In ace this reads as the transcript flickering while an answer streams.
Change
web/stream-hold.js(pure, no DOM) finds where unfinished markup starts on the open line.MarkitRenderer.rendershows the text before it whilefinalizedis false, and the rest once the markup closes, the line ends or the message finishes.Evidence
The "never take back shown text" property, measured over 246 real agent answers streamed through the inline engine:
The remaining cases are footnotes. A definition's
↩backlink sits after its growing text, and a[^1]reference can't resolve until its definition arrives at the end.Tests
web/tests/node/stream-hold.test.mjsstreams an answer one character at a time and in uneven chunks, and fails if any update takes back text. It also checks that held text appears when its line ends, that finished messages show everything, and that code in an open fence streams as it arrives. It fails onmain.node --test tests/node/*.test.mjspasses.shared,renderer,inline,code,github,reactspecs): one clean run of 40/40. Other runs on a heavily loaded machine had one to four flaky failures, a different set each time; the same specs passed on rerun.