Skip to content

Thread timeline shifts already-rendered content on slow connections (phone row reveal, streaming reply, streaming HTML, GenUI fence swap) #8547

Backlog

Description

@smsunarto

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 on main at 4d7a9af609.
  • 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

  1. In Chrome DevTools, set Network to Slow 4G (562.5 ms RTT, 180 kB/s, cache off) and CPU to 4x slowdown.
  2. Collect shifts with:
    new PerformanceObserver(l => l.getEntries().forEach(e => !e.hadRecentInput && console.log(e.value, e.sources))).observe({type: "layout-shift", buffered: true})
  3. Cold open: clear site data, set the viewport to 390x844, and open a long thread with code blocks, images and a GenUI fence.
  4. Send: in that thread, send a message whose reply streams about 4 kB of Markdown. Repeat at 1440x900.
  5. 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-visibility is 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, resolveMarkdownPiecesUnlessHtml falls 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

A fix is ready in a linked PR.

AGENT GENERATED

Activity

  1. added theissue type on Dec 2, 2026
  2. added
    threads
    ui
    partial-repro
    on Dec 2, 2026
  3. bb-slop-cop commented on Dec 2, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    partial-reprothreadsui

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions