Repository navigation
Labels
partial-reproBug partially reproduced; some claims unverified; see linked reportthreadsTurns, timeline, messaging, forksuiApp shell, sidebar, composer, rendering
Description
Summary
On a slow connection the thread timeline moves content that is already on screen, in four ways:
- Phone rows reveal at their real size after painting.
- A streaming reply moves the rows above it and its own finished blocks.
- A reply with HTML is reparsed as one whole document on every streamed token.
- A GenUI code fence swaps from a code block to the plugin card.
The largest is a phone send: the reply's layout-shift score reaches 1.9 for plain text and 2.4 for HTML.
Versions and environment
- bb from source at
e0c49e2e5d. The cited code is unchanged onmainat4d7a9af609. - Chrome 156, Node 24.
- Source-built dev instance with a fixed fixture database. The agent replays a long Markdown reply, optionally with HTML (
<details>with a table,<kbd>, a centred<div>with an image and<sub>caption).
Steps to reproduce
- In Chrome DevTools, set Network to Slow 4G (562.5 ms RTT, 180 kB/s, cache off) and CPU to 4x slowdown.
- Collect shifts with:
new PerformanceObserver(l => l.getEntries().forEach(e => !e.hadRecentInput && console.log(e.value, e.sources))).observe({type: "layout-shift", buffered: true}) - Cold open: clear site data, set the viewport to 390x844, and open a long thread with code blocks, images and a GenUI fence.
- Send: in that thread, send a message whose reply streams about 4 kB of Markdown. Repeat at 1440x900.
- HTML: repeat step 4 with a reply that contains HTML.
Expected vs actual
Expected: content already on screen stays put while rows mount and replies stream.
Actual: summed layout-shift score per load, by cause. Values are the shifts attributed to each cause, not page CLS.
| Cause | Page / width | Score |
|---|---|---|
| Phone rows reveal at real size | long thread, 390 | 0.664 |
| Phone rows reveal at real size | PR-review threads, 390 | 0.261 / 0.179 |
| Phone rows reveal at real size | cold open, reply with HTML, 390 | 0.869 |
| Streaming reply moves content | send, 390 / 1440 | 1.921 / 0.479 |
| Streaming reply moves content | send with HTML, 390 / 1440 | 2.35–2.42 / 0.60–0.63 |
| Sent message row swap | send, 390 | 0.121 (0.161 with HTML) |
| Code fence → plugin card | cold, 390 (3 threads) | 0.059 / 0.059 / 0.030 |
| Code fence → plugin card | returning device, 390 / 1440 | 0.105 / 0.018 |
| Unread divider inserted above shown rows | returning device + new messages, 1440 | 0.011 |
Cause (observed in traces, then confirmed by changing it)
- Phone rows:
content-visibilityis armed two frames after a row paints (timeline-row-containment.ts#L22-L30). Chrome scores the children of a painted row that gains containment as moved by the scroll offset. - Streaming:
- The scroll keeper re-pins in a ResizeObserver (scroll-position-keeper.ts#L314-L327). Chrome records the shift before ResizeObserver callbacks run, so the pin always lands too late.
- The reply renders as two Markdown roots, settled and tail (ConversationMessageContent.tsx#L515-L540), so blocks are re-created as they cross the boundary.
- An image of unknown size grows with no DOM mutation.
- The live row is contained, and growth inside a contained box scores even when the scroller is pinned.
- HTML: once a message contains HTML,
resolveMarkdownPiecesUnlessHtmlfalls back to whole-document rendering for every later token (markdown-incremental-pieces.ts#L652-L670). Settled HTML is reparsed and re-rendered per token, and a table in it rewraps once its column width is measured. - Code fences: while plugin frontends haven't settled, a fence shows the raw code block with a waiting status, then swaps to the plugin card at a different height (markdown-code-fence-renderers.tsx#L398-L414).
What I ruled out
- No duplicate: Thread context card moves the transcript 132 px when its first row's data arrives #8531 (context card) and Inline visualization loading causes a timeline layout jump #1837 (inline-vis loading) are different elements.
- Bundling the HTML renderer eagerly doesn't fix the cold HTML open (still 0.128 at 390). The table rewrap is the cause.
- Batching the keeper's height reads per frame or per task brings phone-send shifts back to 0.13–0.30, so the per-mutation read is needed.
A fix is ready in a linked PR.
AGENT GENERATED
Metadata
Metadata
Assignees
Labels
partial-reproBug partially reproduced; some claims unverified; see linked reportthreadsTurns, timeline, messaging, forksuiApp shell, sidebar, composer, rendering
Activity
bb-slop-cop commentedon Dec 2, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotthreads,uipartial-repro