Agent pane: tall Edit diffs draw over each other and the pane flickers while a step streams #552
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What happens
During a thorough run's
openspec.propose, the agent pane drew rows over each other, and the screen started flickering hard. This was on production, 2026-11-15, with "show thinking" on.Edit spec.mdrow shows its side-by-side diff in a box whose last line is cut through. The next row is drawn over that cut line, in the same place.This looks like a row's measured height disagreeing with its drawn height. The list lays out the next row at the measured height, the row then grows, and it is measured again, round and round. The step was writing many edits to one spec file, each a tall wrapped diff, while its live text streamed.
Related, all closed: braid#22 (a report overlapping the rows below), braid#210 (a jumpy transcript while streaming), braid#375 (rows landing above the thought that started them).
Fix
Find what changes an
Editrow's height after it is measured: wrapping in the two diff columns, the diff loading after the row appears, or the live tail above it. Then give the row its final height before the list places the rows after it, so it is measured once.Done when
A browser test streams a step that makes several tall
Editrows of a wrapped spec diff. No two rows overlap, and the list stops re-laying itself out once the stream is quiet.It reproduces every time (the owner, 2026-11-15). On run 200, which was still running, open its
openspec.proposestep and scroll up to theEditdiffs: the pane starts to flicker.So it is not only the live tail. Rows the list draws again as they scroll back into view are measured in a loop too, which points at the
Editrow's own height, not at the streaming. The browser test in Done when should scroll back up through those rows, not only stream them.Found: a diff switches between split and unified on every frame
Reproduced on run 200's
openspec.proposein my own Chromium, scrolling up with the wheel. It needs two conditions: classic scrollbars, which macOS shows when a mouse is connected, and an agent pane whose diff box is just over 1000 px wide. At a 1472 px window the list changed on 29 or 30 of every 30 frames and never settled. At 1480 px, and at 2000 px, it settled at once. With the hidden scrollbars of a default headless browser it never happens.One diff, frame by frame:
DiffBlock(ui/src/components/ToolBlocks.tsx) chooses split when its ownclientWidthis at leastSPLIT_MIN_WIDTH(1000), measured on the box that scrolls pastBLOCK_MAX_HEIGHT(400):clientWidthto 996.clientWidthis back to 1006.The row's height swings between 400 and 320 px with each switch, so the list moves every row below it on every frame. That is the text drawn over itself, and the flicker. It was never about streaming. Any such diff does it once the pane is the wrong width.
Fix
Choose the layout from a width the box's own scrollbar cannot change:
offsetWidth(1006 throughout above), or the width of the row that holds the box. Giving the boxscrollbar-gutter: stablewould also holdclientWidthstill, but it costs every diff a gutter.Done when
A test drives the diff's layout choice at a width where the scrollbar would cross the switch, with content that overflows only when split, and the layout holds still. Browser journeys run with hidden scrollbars, so this needs a unit test of the width read, or a journey launched with scrollbars shown.
Shipped in #555 (change
console-diff-run-bar-count), live asff34e7fsince 17:06 UTC on 2026-11-18 (archived in #556).A diff now chooses two columns or one from its box's
offsetWidth, which its own scrollbar does not change. It lays itself out once at any width.Evidence. The new journey
ui/e2e/scrollbars.spec.tsstarts Chromium with its scrollbars drawn and sizes the box to 1004 px, split and scrolling, where its scrollbar takesclientWidthto 994.