Skip to content

ui-react: when the transcript's viewport shrinks without a scroll, a finished turn is neither seen nor offered Scroll to latest #3807

Open

Description

@schlessera

Context

A finished turn can end up neither counted as seen nor offered Scroll to latest. Its tracker then stays done and uncleared until the reader happens to scroll. Reproduced on demand on main 631bbae2c: receipt, table and commands.

  • The control and the tailing flag are recomputed only inside a scroll handler (handleScroll, packages/ui-react/src/components/chat/chat-page.tsx:320-326).
  • The seen proof needs the transcript within 20 px of its end (AT_BOTTOM_PX, packages/ui-react/src/hooks/use-tracker-seen.ts:7, checked at :45).
  • When the transcript's viewport shrinks by 20 px or more while the reader is at the end, no scroll event fires. The composer growing does this: a late attachment thumbnail, a restored multi-line draft, the tall voice field. The end of the turn is now out of view, so it is not seen, and the control is still hidden because nothing recomputed it.
  • Neither existing resize observer covers it. The column observer re-tails when content grows (const observer, chat-page.tsx:273-276). The tray observer restores the scroll position when the recordings tray grows (const observer, chat-page.tsx:292-299). Neither recomputes the at-end state.

Measured in the unchanged 1440 desktop case, with the composer grown behind the Files panel before returning to Chat: 0 px and 10 px clear at once; 24 px, 64 px and 400 px stay stuck with the control absent, every time.

Hosted sightings. Two, both at the 30 s wait for Scroll to latest in press (packages/ui-react/tests/parallel-sessions-runtime.test.ts:469), called from the fallback (const disc, :780): PR #3805's run 42657353591 and main run 42875027911. Which element changed height there was not captured; #3805's late composer thumbnail is the likely trigger.

Scope

  • Recompute the at-end state whenever the scroller's own box changes size, with no scroll event needed: set the control's visibility and the tailing flag from the actual position, then run the seen observer.
  • Add a focused real-browser case for it. The step that reproduces it: while Files covers Chat and a finished turn is unseen, grow the composer by 24 px, then return to Chat.

Out of scope

  • Moving the transcript when its viewport shrinks. This issue makes the control truthful. Whether a tailing transcript should also follow a growing composer is a separate behaviour question; file it if wanted.
  • The recordings-tray rule: the scroll position is kept when the tray grows.
  • AT_BOTTOM_PX, the seen and clear assertions, test deadlines, propagation changes and retry loops.

Acceptance criteria

  • A focused real-browser case fails on main: after the composer grows by 24 px behind Files and the reader returns to Chat, the turn's tracker is done and not cleared, and no Scroll to latest is visible. With the fix the control is visible, and pressing it clears the tracker. The PR records both runs.
  • After a size change of the scroller, the control is visible exactly when the transcript is 20 px or more from its end. A test asserts it without dispatching a scroll event.
  • The existing 1440 desktop and 390 phone parallel-session cases and the recordings-tray cases pass with no assertion or deadline changed.
  • The hosted runtime proof for the PR passes.

Verification

BRAIN_REQUIRE_CHROME=1 bun run test packages/ui-react/tests/parallel-sessions-runtime.test.ts -t '1440 desktop.*A and B stream'
bun run check:pr --base origin/main

Keep the failing-first run of the new case. No API key or external network is needed.

Contract impact

None. No CLI, MCP, wire, schema or frontmatter change.

Triage 2026-11-14 at main c82e30ae4: rewrote the brief around the demonstrated product gap and refreshed the anchors. Added agent-ready. type: fix, priority: p2, parent #2753 and no milestone are unchanged.

Earlier brief, receipts and triage history. The sections above replace it where they differ.

Out of scope

No propagation changes, deadline increases, assertion removal, broad retry loop or production behavior change without evidence of a product defect.

Context

The desktop parallel-session browser case timed out waiting for the Scroll to latest button after returning from Files to Chat. This is a suspected harness synchronization/visibility edge case; its cause is unconfirmed.

  • Observed on PR CONTRACT: feat(ui-react): upload every image as its original, with a frame that names it (#3155) #3805 head 2922f3c693330944d18d571065ccfc2dc899b8b1, CI run 42657353591, unit (2).
  • Actual job checkout: e431edd8525aa521e6025ab348e17c668693f2c7.
  • Failing case: mounted parallel sessions > 1440 desktop, light, fine pointer, reduced motion: A and B stream side by side; trackers follow success, failure and a queued follow-up, and clear only once seen.
  • At 16:54:11 UTC on 2026-11-09, Playwright exhausted its 30,000 ms visibility wait for getByRole('button', { name: 'Scroll to latest', exact: true }).first().
  • The worker reported 2,001 passes and this one failure before the other local worker was terminated.

At that immutable checkout, press (packages/ui-react/tests/parallel-sessions-runtime.test.ts:469-473) first waits for visibility. The fallback (const disc = button, packages/ui-react/tests/parallel-sessions-runtime.test.ts:780-782) waits three seconds for A to clear, then calls press if that wait rejected. State can change between those two waits; the log alone does not identify whether that happened here. Capture that boundary before choosing a repair.

Natural receipt, read 2026-11-10 from the job log. The 3-second wait failed at 16:53:41.527 UTC, exactly 30 s before the visibility timeout. The until helper's diagnostic (until, packages/ui-react/tests/parallel-sessions-runtime.test.ts:287-294 at main) logged this:

never held: p.views().find((v) => v.sessionId === "odysseus-parallel-86")?.cleared === true
{"views":[{"sessionId":"odysseus-parallel-86","state":"done","pendingKind":null,"cleared":false,"turnId":"fdf7bff8-…","settled":true}],"active":"odysseus-parallel-86","draft":{"text":"","images":0,"sessionId":null}}

So, 3 s after returning to Chat, A was active, done and settled, but not cleared. No "Scroll to latest" control became visible in the next 30 s. Nothing in the log says whether A cleared later in that window. A late clear would also explain the missing control, because the view would already be at its latest turn. Two explanations remain, and the log cannot tell them apart:

  1. A late but legitimate clear. The fallback then waits for a control that is correctly absent.
  2. A product state in which the latest turn is not counted as seen while the transcript also offers no Scroll to latest.

Anchors at main 3aadc8df5. press is at parallel-sessions-runtime.test.ts:466-470, and the fallback (const disc = button) is at :776-778. The case's fixture differs from the observed checkout only in unrelated attachment lines.

Triage reproduction status. No runtime reproduction was attempted. It needs real Chrome, a dependency install and an instrumented copy of the case, and its failure rate is low (one in 2,002 cases in that worker), so it is not a cheap bounded check. Completion evidence for needs: repro is a trace or controlled-delay run of this case. It must record cleared, the control's presence, transcript scroll metrics and page visibility from the Chat click until the fallback times out. Either explanation above, demonstrated, completes it.

Related #3377 is closed and concerned phone session C remaining uncleared after a press, traced to a touch fling. This observation is on desktop session A and fails before the press. Open #3414 concerns duplicate announcements and is also a different assertion.

This follow-up was found while preparing #3458. Under the maintainer's direction, likely timing flakes are recorded separately while the propagation implementation proceeds.

Scope

Capture tracker cleared state, button visibility, transcript scroll metrics and page visibility across the Files-to-Chat transition. Determine whether the fallback races a legitimate clear or a product state/visibility problem. Repair the demonstrated cause in a separate change.

Acceptance criteria

  • A focused trace or controlled-delay reproduction identifies why the button is absent when the fallback waits for it.
  • The repair preserves the seen/clear assertions and existing deadlines.
  • The focused desktop case demonstrates the old failure and passes with the repair; the affected hosted runtime proof passes.

Verification

Use the real browser harness through bun run test packages/ui-react/tests/parallel-sessions-runtime.test.ts -t '1440 desktop.*A and B stream'. Retain a failing-first or restored-mutation receipt for the identified cause. No API key or external network is needed.

Contract impact

None established. This is an unconfirmed test/runtime follow-up, with no proposed CLI, MCP, wire, schema or frontmatter change.

Triage 2026-11-10 at main 3aadc8df5: folded the natural receipt's state at the 3-second deadline and the current anchors into Context. Added priority: p2 (wanted, unscheduled browser-harness investigation; no milestone commitment) and attached to #2753 (browser verification is deterministic and attributable). Kept needs: repro.

Second occurrence on main — 2026-11-10

Main CI run 42875027911, unit (2) at b77987afb (the #3805 squash) failed the same case and wait: press timed out after 30,000 ms waiting for Scroll to latest (parallel-sessions-runtime.test.ts:470, called from :781). Both recorded occurrences are on #3805's tree (its head 2922f3c69, then its merge); the previous main run at b6c330a60 passed, and the unit shards of the next two main runs (462afada5, 96ba8a7c8) passed.

Hypothesis, not established (comment): #3805 makes a composer image thumbnail a derived frame that appears only after the host stores the original. A late thumbnail changes the composer's height after the return to Chat, which could leave A's latest turn at the viewport edge, neither counted as seen nor far enough away to show the control. If it holds, the gap is in seen-state handling rather than the harness. The boundary capture asked for above is still the completion evidence.

Triage 2026-11-10 at main 91e54be37: folded the second occurrence and the #3805 hypothesis. needs: repro, priority: p2 and parent #2753 unchanged.

Reproduction and cause — 2026-11-13

The stuck state reproduces on demand on main 631bbae2c: receipt, table and commands. It is a product gap in seen-state handling.

  • Scroll to latest is drawn only after a scroll event (handleScroll, packages/ui-react/src/components/chat/chat-page.tsx:319-325). The seen proof needs the transcript within 20 px of its end (AT_BOTTOM_PX, packages/ui-react/src/hooks/use-tracker-seen.ts:7).
  • When the composer grows by 20 px or more while the reader is at the end, the transcript's viewport shrinks without a scroll event. The turn is then neither proved seen nor offered the control.
  • Growing the composer by 24 px or 64 px behind the Files panel makes the unchanged 1440 case stick every time, with the control absent; 0 px and 10 px clear at once.

This is the 2026-11-10 hypothesis above, now demonstrated as a mechanism: the gap is in seen-state handling, not the harness. Which element changed height on the hosted runner is still not captured; #3805's late composer thumbnail remains the likely trigger.

Acceptance criteria: the first is met by this reproduction. The other two stand. The repair they ask for is to recompute the at-end state when the scroller's own box resizes (re-tail when tailing, otherwise show the control, then run the seen observer). The composer-growth step is the focused failing-first case: it fails on main at 24 px and should pass with the repair.

Triage 2026-11-13 at main 631bbae2c: added the reproduction and cause, marked the first acceptance criterion met, removed needs: repro, changed type: test to type: fix.

Activity

  1. added
    type: test
    area: ui-react
    needs: repro
    priority: p2
    on Nov 9, 2026
  2. schlessera commented on Nov 10, 2026

    @schlessera
    OwnerAuthor

    2026-11-10 triage at main 3aadc8df5: the natural job log shows A done, settled and not cleared at the 3-second fallback deadline. No Scroll to latest control appeared in the next 30 s, and the log cannot tell a late legitimate clear from a product seen-state gap. Recorded this and the current anchors (press :466-470, fallback :776-778) in the body. No runtime reproduction was attempted: it needs real Chrome, an install and an instrumented case, at a rate of about one failure per 2,000 cases. Keeps needs: repro, whose completion evidence is now stated in the body. Added priority: p2 (wanted, unscheduled) and attached to #2753.

  3. schlessera commented on Nov 10, 2026

    @schlessera
    OwnerAuthor

    Second occurrence (2026-11-10), on main.

    Both recorded occurrences are on #3805's tree: the first on its head 2922f3c69, now on its merge. The previous main run, at b6c330a60, passed.

    #3805 changed one thing here: a composer image thumbnail is now a derived frame. It appears only after the host has stored the original, and it is rebuilt from that original after a remount. #3805 had to add explicit img waits elsewhere in this file for that reason. A thumbnail that arrives late changes the composer's height after the return to Chat. That could leave A's latest turn at the edge of the viewport, neither counted as seen nor scrolled far enough away to show the control.

    This is a hypothesis, not established. It still needs the boundary capture this issue already asks for. If it holds, the gap is in seen-state handling, not in the harness.

  4. schlessera commented on Nov 13, 2026

    @schlessera
    OwnerAuthor

    The stuck state reproduces on demand (2026-11-13), and the cause is in product code: a seen-state gap, not a harness race.

    Mechanism. Three facts in the source combine:

    • Scroll to latest is drawn from showScrollButton, and only a scroll event sets it (handleScroll, packages/ui-react/src/components/chat/chat-page.tsx:319-325).
    • The tracker's seen proof needs the transcript within 20 px of its end (AT_BOTTOM_PX, packages/ui-react/src/hooks/use-tracker-seen.ts:7, checked at :45).
    • Tailing follows growth of the content column (columnRef, chat-page.tsx:267-277). The scroller's own observer only compensates for the recordings tray (trayHeight, chat-page.tsx:286-301).

    So when the transcript's viewport gets 20 px or more shorter while the reader is at the end, because the composer below it grew, nothing happens: scrollTop is unchanged, no scroll event fires, the transcript is now 20 px or more from its end, the seen observer returns false, and no control appears. The tracker stays done and uncleared until the reader scrolls by hand or new content arrives.

    Reproduction. Main 631bbae2c, a 4-CPU Ubuntu 24.04 VM, Chrome 151, idle. The unchanged case 1440 desktop, light, fine pointer, reduced motion: A and B stream side by side; … with one added step: right after the a panel over Chat is not seen assertion, while Files still covers Chat, the composer grows by N px (bottom padding on [data-composer]). The test then presses Chat as before. I also replaced the bare 30 s locator wait with a probe of the scroller, so the failure carries its numbers.

    Composer growth Outcome Scroller at the wait (scrollHeight / scrollTop / clientHeight) Distance from end Control
    0 px (control) cleared at once
    10 px cleared at once
    24 px stuck, 2 of 2 3280 / 2545 / 711 24 px absent
    64 px stuck, 2 of 2 3280 / 2545 / 671 64 px absent
    400 px stuck, 1 of 1 3280 / 2545 / 335 400 px absent

    The tracker view at the wait is {"state":"done","settled":true,"cleared":false}, and it is identical five seconds later. That is the hosted failure exactly: cleared never becomes true within the 3 s window, and the fallback then waits for a Scroll to latest button that is correctly absent from the DOM. The threshold also matches: 10 px clears, 24 px sticks, and the constant is 20.

    What I could not do. Make it happen without the added step. Twelve unchanged cases (three widths, four rounds, under three busy loops on four CPUs) all cleared at once and never used the fallback. So this shows the mechanism is sufficient and yields the same state; it does not show which element changed height on the hosted runner.

    On #3805 as the trigger. Both sightings are still on its tree. I checked the one candidate counter-example: the same test also failed on main on 2026-11-08 (run 42527788910), before #3805, but at a different assertion (B's failure is spoken once, line 722), which #3745 closed. The body's 2026-11-10 hypothesis is that #3805's composer thumbnail appears late and changes the composer's height after the return to Chat. That is exactly the height change this reproduction injects, so the hypothesis now has a demonstrated mechanism. It is still not proved that the thumbnail is what moved on the hosted runner.

    Fix direction. When the scroller's own box changes size, recompute the at-end state: re-tail if the reader was tailing, otherwise update showScrollButton, then run the seen observer. The scroller already has a ResizeObserver for the tray, so there is a place for it. The added step above is a ready failing-first test: it fails on main at 24 px and should pass after the change.

    Who meets this outside the test. Anyone whose finished, unseen turn is on screen when the composer grows: a restored draft with attachment thumbnails, a multi-line draft, or the tall voice field. The chat keeps its unseen marker and offers no way to clear it short of scrolling.

    I removed needs: repro and changed type: test to type: fix, since the gap is in chat-page.tsx, not in the harness. The body has the summary.

  5. added
    type: fix
    and removed
    type: test
    needs: repro
    on Nov 13, 2026
  6. changed the title [-]ui-react: desktop parallel-session runtime can wait for an absent Scroll to latest control[/-] [+]ui-react: when the transcript's viewport shrinks without a scroll, a finished turn is neither seen nor offered Scroll to latest[/+] on Nov 14, 2026
  7. added
    agent-ready
    on Nov 14, 2026
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

    agent-readyarea: ui-reactpriority: p2type: fix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions