Skip to content

fix(web): a thread opening is not painted before it is positioned - #1122

Open
yaacovcorcos wants to merge 3 commits into
mainfrom
claude/timeline-landing-scroll-wait-20261125
Open

yaacovcorcos wants to merge 3 commits into
mainfrom
claude/timeline-landing-scroll-wait-20261125

Conversation

@yaacovcorcos

@yaacovcorcos yaacovcorcos commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Fixes a flaky web test and the app flaw it was covering: opening a thread showed it at the previous thread's scroll position for a frame or more before it moved into place.

The flaky test

MessagesTimeline › "opens a working parent thread at its end without landing short" failed twice in a row on #1121 (docs only) with expected 0 to be greater than 0.

Cause (reproduced in review). The restore's end scroll moves scrollTop at once, but the browser fires the scroll event on the next frame. When the parent reached its end within one frame, waitFor passed before any scroll event had been recorded. Fix: the "a scroll was recorded" check moves inside the waitFor; any recorded scroll that lands short still fails.

The product fix

The list isn't keyed per thread, and the restore positions an opening a frame or more after its rows commit (the end scroll, a saved row, history paging in). So the first painted frame showed the new thread at the old offset, usually its top: opening a parent from its subagent showed turns 0–4, then jumped to 27–29.

MessagesTimeline.tsx: from the moment an opening's rows mount until it reports positioned, a cover (bg-background, above the minimap) sits over the timeline. Whatever path the restore takes, it covers that opening only. It is shown after 1 s at most if the restore never reports, and that expiry is reset with each opening.

  • The list underneath stays readable and focusable. F6 and text reading work right after an opening.
  • The cover takes presses, so a blind click can't act on hidden content. Playwright clicks wait for it.
  • Why a cover, not opacity: switching opacity on the scroller's ancestors mid-restore undid a reader's scroll. The existing "leaves a scroll without reader input" test failed 2 of 3 runs with an early reveal; with the cover, 0 of 6.
  • Immediate paths still paint at once. Citations and first-prompt placement report positioned before paint, so they show no blank frame.

Tests

  • Working-parent test: until the parent is positioned, each DOM change and scroll is sampled. Once the parent's rows show, the timeline must be covered or at its end. It also checks a visible sample was taken, with a bounded wait and cleanup registered first. It fails without the fix (the parent shown 5,644 px from its end).
  • readerScrolling.browser.test.tsx (Scient-owned):
    • An opening whose cached rows show while its history loads stays covered, then shows at its end.
    • An opening that never reports is shown after the fallback, and the next visit is covered again.
    • Both fail without the fix.

Checks run

  • The timeline and reader-scrolling files: 3/3 runs, all 98 tests.
  • The 41 browser test files that render the timeline or ChatView: 2/2 runs, all 449 tests.
  • Web typecheck, lint and the alignment seam check pass.

Review: Codex GPT-6.2 Sol, two rounds so far (reviews/ci-speed-20261124/review-pr1122.md, review-pr1122-round2.md).

Platforms: shared web timeline code, the same on macOS, Windows and Linux. Verified only in Chromium on macOS.

🤖 Generated with Claude Code

A browser fires scroll events on the next frame, after scrollTop has
moved. When the parent landed at its end within one frame, the wait saw
the end before any scroll was recorded and the test failed with no
shortfalls (twice on PR #1121's Web 10). The recorded-scroll check now
sits inside the wait; a scroll that lands short still fails the test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:XS labels Nov 25, 2026
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 5.5 KiB 5.5 KiB 0 B (0.0%) 6.8 KiB ✅
Codex Thread snapshot wire 4.2 KiB 4.2 KiB 0 B (0.0%) 4.9 KiB ✅
Codex Live turn WebSocket wire 1.3 KiB 1.3 KiB 0 B (0.0%) 2.0 KiB ✅
Codex Live turn WebSocket decoded 22.3 KiB 22.3 KiB 0 B (0.0%) 24.4 KiB ✅
Codex Live turn messages 1 1 0 (0.0%) 8 ✅
Claude Total thread wire 5.5 KiB 5.5 KiB 0 B (0.0%) 6.8 KiB ✅
Claude Thread snapshot wire 4.2 KiB 4.2 KiB 0 B (0.0%) 4.9 KiB ✅
Claude Live turn WebSocket wire 1.3 KiB 1.3 KiB 0 B (0.0%) 2.0 KiB ✅
Claude Live turn WebSocket decoded 22.7 KiB 22.7 KiB 0 B (0.0%) 24.4 KiB ✅
Claude Live turn messages 1 1 0 (0.0%) 8 ✅

Other scenarios

All 64 scenario measurements match main.

All 64 scenario measurements
Provider Scenario Metric Main baseline This PR Impact PR ceiling
Codex short turn resume WebSocket decoded 12.0 KiB 12.0 KiB 0 B (0.0%) 12.7 KiB ✅
Codex short turn resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex long turn running, cold open HTTP decoded 281.7 KiB 281.7 KiB 0 B (0.0%) 302.7 KiB ✅
Codex long turn running, cold open rows 75 75 0 (0.0%) 75 ✅
Codex long turn running, history page HTTP decoded 92.4 KiB 92.4 KiB 0 B (0.0%) 107.4 KiB ✅
Codex long turn running, history page rows 75 75 0 (0.0%) 75 ✅
Codex long turn finished, cold open HTTP decoded 381.5 KiB 381.5 KiB 0 B (0.0%) 410.2 KiB ✅
Codex long turn finished, cold open rows 151 151 0 (0.0%) 151 ✅
Codex long turn finished, socket cold open WebSocket decoded 381.6 KiB 381.6 KiB 0 B (0.0%) 410.2 KiB ✅
Codex long turn finished, socket cold open WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex long turn finished, socket cold open rows 151 151 0 (0.0%) 151 ✅
Codex long turn finished, work page HTTP decoded 186.2 KiB 186.2 KiB 0 B (0.0%) 200.2 KiB ✅
Codex long turn finished, work page rows 150 150 0 (0.0%) 150 ✅
Codex idle thread resume WebSocket decoded 65 B 65 B 0 B (0.0%) 200 B ✅
Codex idle thread resume WebSocket messages 1 1 0 (0.0%) 1 ✅
Codex fleet shell snapshot HTTP decoded 45.5 KiB 45.5 KiB 0 B (0.0%) 53.7 KiB ✅
Codex fleet shell snapshot rows 27 27 0 (0.0%) 27 ✅
Codex fleet shell subscribe WebSocket decoded 65 B 65 B 0 B (0.0%) 200 B ✅
Codex fleet shell subscribe WebSocket messages 1 1 0 (0.0%) 1 ✅
Codex fleet shell resume check HTTP decoded 18 B 18 B 0 B (0.0%) 100 B ✅
Codex fleet shell resume check rows 0 0 0 0 ✅
Codex stale shell reload HTTP decoded 45.5 KiB 45.5 KiB 0 B (0.0%) 53.7 KiB ✅
Codex stale shell reload rows 27 27 0 (0.0%) 27 ✅
Codex stale shell resume WebSocket decoded 140 B 140 B 0 B (0.0%) 400 B ✅
Codex stale shell resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex stale todo list cold open HTTP decoded 72.4 KiB 72.4 KiB 0 B (0.0%) 83.0 KiB ✅
Codex stale todo list cold open rows 75 75 0 (0.0%) 75 ✅
Codex stale todo list cold open nodes 2 2 0 (0.0%) 4 ✅
Codex stale todo list cold open subagents 2 2 0 (0.0%) 4 ✅
Codex stale todo list cold open plans 1 1 0 (0.0%) 2 ✅
Codex stale todo list cold open providerTurns 1 1 0 (0.0%) 2 ✅
Codex stale todo list cold open checkpoints 1 1 0 (0.0%) 2 ✅
Claude short turn resume WebSocket decoded 12.2 KiB 12.2 KiB 0 B (0.0%) 12.7 KiB ✅
Claude short turn resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude long turn running, cold open HTTP decoded 283.3 KiB 283.3 KiB 0 B (0.0%) 302.7 KiB ✅
Claude long turn running, cold open rows 75 75 0 (0.0%) 75 ✅
Claude long turn running, history page HTTP decoded 93.4 KiB 93.4 KiB 0 B (0.0%) 107.4 KiB ✅
Claude long turn running, history page rows 75 75 0 (0.0%) 75 ✅
Claude long turn finished, cold open HTTP decoded 384.1 KiB 384.1 KiB 0 B (0.0%) 410.2 KiB ✅
Claude long turn finished, cold open rows 151 151 0 (0.0%) 151 ✅
Claude long turn finished, socket cold open WebSocket decoded 384.3 KiB 384.3 KiB 0 B (0.0%) 410.2 KiB ✅
Claude long turn finished, socket cold open WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude long turn finished, socket cold open rows 151 151 0 (0.0%) 151 ✅
Claude long turn finished, work page HTTP decoded 188.1 KiB 188.1 KiB 0 B (0.0%) 200.2 KiB ✅
Claude long turn finished, work page rows 150 150 0 (0.0%) 150 ✅
Claude idle thread resume WebSocket decoded 66 B 66 B 0 B (0.0%) 200 B ✅
Claude idle thread resume WebSocket messages 1 1 0 (0.0%) 1 ✅
Claude fleet shell snapshot HTTP decoded 46.1 KiB 46.1 KiB 0 B (0.0%) 53.7 KiB ✅
Claude fleet shell snapshot rows 27 27 0 (0.0%) 27 ✅
Claude fleet shell subscribe WebSocket decoded 66 B 66 B 0 B (0.0%) 200 B ✅
Claude fleet shell subscribe WebSocket messages 1 1 0 (0.0%) 1 ✅
Claude fleet shell resume check HTTP decoded 18 B 18 B 0 B (0.0%) 100 B ✅
Claude fleet shell resume check rows 0 0 0 0 ✅
Claude stale shell reload HTTP decoded 46.1 KiB 46.1 KiB 0 B (0.0%) 53.7 KiB ✅
Claude stale shell reload rows 27 27 0 (0.0%) 27 ✅
Claude stale shell resume WebSocket decoded 140 B 140 B 0 B (0.0%) 400 B ✅
Claude stale shell resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude stale todo list cold open HTTP decoded 73.4 KiB 73.4 KiB 0 B (0.0%) 83.0 KiB ✅
Claude stale todo list cold open rows 75 75 0 (0.0%) 75 ✅
Claude stale todo list cold open nodes 2 2 0 (0.0%) 4 ✅
Claude stale todo list cold open subagents 2 2 0 (0.0%) 4 ✅
Claude stale todo list cold open plans 1 1 0 (0.0%) 2 ✅
Claude stale todo list cold open providerTurns 1 1 0 (0.0%) 2 ✅
Claude stale todo list cold open checkpoints 1 1 0 (0.0%) 2 ✅

Baseline: bab2d40 · PR result: fa67c5a · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Bounded compact HTTP snapshot with live cursor.

  • Codex decoded thread snapshot: 88.2 KiB
  • Claude decoded thread snapshot: 88.4 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

…itioned

The restore scrolls a thread opening at its end a frame or more after the
new rows commit (a microtask, then Legend's measured end), so the first
painted frame showed the new thread at the previous thread's offset,
usually its top, before it jumped to the end. Opening a working parent from
its subagent painted the parent's turns 0-4 first.

The timeline is now transparent while such an opening is positioned (laid
out, readable and focusable, like a fork landing), shown when the restore
reports it positioned or after 1 s at most. Saved reading positions,
citations, follow resumes and first-prompt placement are unchanged.

The working-parent test now checks every committed change and scroll until
the parent is positioned: once the parent's rows are shown, the timeline is
transparent or at its end. Without the fix it fails with the parent shown
5,644 px from its end.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@yaacovcorcos yaacovcorcos changed the title test(web): working-parent landing test waits for a recorded scroll fix(web): a thread opening at its end is not painted before it is positioned Nov 25, 2026
@github-actions github-actions Bot added size:M and removed size:XS labels Nov 25, 2026
…sitioned

Review of 989fd6b found the end-only gate could change its mind mid-restore
(a saved row arriving), showed cached rows at the wrong offset while history
loaded, let a blind click act on transparent content, and carried an expired
fallback to the next visit of the same thread.

The gate now covers every opening that has rows, from the moment they mount
until the thread reports positioned, whatever path the restore takes. Its
fallback expiry is reset with the other positioning state on each opening.
It is a cover over the timeline (bg-background, above the minimap) rather
than opacity on the scroller's ancestors: switching an ancestor's opacity
mid-restore undid a reader's scroll in the existing 'leaves a scroll without
reader input' test (2 of 3 runs with the reveal forced early, 0 of 6 with
the cover). The cover also takes presses, and Playwright clicks wait for it.

New tests (readerScrolling.browser.test.tsx) cover an opening whose cached
rows show while its history loads, and a fallback reveal followed by a later
visit. Both fail without the fix. The working-parent test bounds its wait,
registers cleanup first, and checks a visible sample at the end.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@yaacovcorcos yaacovcorcos changed the title fix(web): a thread opening at its end is not painted before it is positioned fix(web): a thread opening is not painted before it is positioned Nov 25, 2026

This branch has not been deployed

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

Labels

size:M vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant