Skip to content

fix(web): returning to a finished thread no longer scrolls through its new work - #38754

Closed
pouyarezvani wants to merge 1 commit into
pingdotgg:mainfrom
pouyarezvani:fix/thread-return-scroll
Closed

pouyarezvani wants to merge 1 commit into
pingdotgg:mainfrom
pouyarezvani:fix/thread-return-scroll

Conversation

@pouyarezvani

Copy link
Copy Markdown
Contributor

Problem

Leave a thread while its agent works, come back after it finishes (more than 5 minutes later), and the timeline slides through everything the agent did before it reaches the end. On a long run it reads as a scroll from top to bottom.

Five minutes after you leave a thread, the client stops following it, so coming back reopens the thread from its disk cache. That copy still says the run is working. MessagesTimeline picks LegendList's animated keep-at-end mode whenever isWorking is true, so it starts an animated scroll to the end of the stale copy. When the server's fresh snapshot lands, LegendList retargets the scroll already in flight to the new end, and the animation runs through every new row.

Fixes #38753.

Change

The animated keep-at-end mode is for rows that stream in while you watch. MessagesTimeline now uses it only when the thread is live: ThreadTimeline passes its existing syncing flag through, and while the thread shows a cached or catching-up copy the list keeps the end without animating. A snapshot lands while the thread still reports synchronizing, so the catch-up arrives at the end in one step. Once the thread is live again, streaming keeps its smooth follow.

Scope

  • Web and desktop: fixed here (desktop renders the web timeline).
  • Mobile: its thread feed already keeps the end without animating, so it is unaffected.
  • Guest page: has no disk-cache reopen; it doesn't pass the new prop and behaves as before.
  • Coming back within 5 minutes reuses the in-memory copy, which doesn't slide; the view still shows that copy briefly before it updates, as before.

Verification

Recorded on a dev server holding only demo data. The demo thread copies the shape of a real long run (counts, order and sizes of its items) with filler text. A page reload stands in for the 5-minute absence; both reopen the thread from the disk cache.

Frames right after clicking back in, 100 ms apart. Before (main): the stale "Working for…" view, then the content glides up for about 450 ms.

return-before-frames

After: the stale view, then the end on the next frame.

return-after-frames

Before and after side by side, quarter speed:

return-slide-quarter-speed.mp4

Real speed:

return-slide-realtime.mp4

Same thread, same starting point (scrollTop 279 of 1027):

scrollTop per frame after the click smooth scrollTo calls
main 279 → 281 → 290 → 306 → 337 → 392 → 486 → 601 → … → 1034 over ~450 ms 2, from LegendList's keep-at-end handler
this PR 279 → 1034 0
  • New browser test: a working thread that is still syncing takes a burst of new rows and reaches the end with no smooth scrollTo. It fails on main (a smooth scroll to 2191).
  • vp test run apps/web/src/components/chat/MessagesTimeline.browser.test.tsx: 72 passed.
  • vp run check:changed: format, lint, knip, typecheck, tests and React compiler pass.

Claude Opus 5.5 in Claude Code (T3 Code).

🤖 Generated with Claude Code

…s new work

A thread the client stopped following reopens from its disk cache, which can
still say the run is working. The timeline used LegendList's animated
keep-at-end mode for that stale copy, and when the fresh snapshot landed the
in-flight animation was retargeted to the new end and scrolled through every
new row. Animate the follow only once the thread is live again, so a cached or
catching-up copy lands at the end at once.

Fixes pingdotgg#38753

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

Closing: pouyarezvani already has 3 or more open PRs here, which is the limit for contributors who are not vouched.

Once one of them is merged or closed, open this again. See the open PR limit.

@github-actions github-actions Bot closed this Nov 18, 2026
@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Nov 18, 2026
@juliusmarminge

Copy link
Copy Markdown
Member

Thanks for this. #38765 makes the same change and is the one being kept.

#38765 carries the exact same fix and regression test at the same commit. It is the open replacement for this submission after the contributor PR limit closed it.

Your implementation and supporting evidence remain intact there, so review should continue on that submission.

Closing as a duplicate.

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

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Returning to a thread that finished while you were away scrolls through its new work

2 participants