[Bug]: Chat stops short of the end when a long answer lands while following
Before submitting
- [x] I searched existing issues and did not find a duplicate.
- [x] I included enough detail to reproduce or investigate the problem.
Area
- [x] apps/web
Steps to reproduce
- Open a thread with some history and stay at the bottom so the chat follows the turn.
- Send a text-only prompt that produces one long answer, for example: "no tools, give me facts about something, respond with 200 facts of about 30 words each".
- Let the model think, then let the answer land in one large update while the turn is still working.
It reproduces every time when the turn ends within about a second of the answer landing, which is what happens when a model thinks first and then sends the whole answer at once. No panel resizing, zooming or other interaction is needed.
Expected behavior
While the chat is following, it ends at the bottom of the new answer.
Actual behavior
The chat starts scrolling toward the new end, then stops partway, typically 2,000–4,000px short (around fact 100 of 200). "Scroll to end" stays hidden, so the chat still behaves as if it were following, but nothing brings it back to the bottom.
Recording, with an on-screen readout of the distance from the bottom (red once the chat is stuck short, idle and without "Scroll to end"). It replays the stop at quarter speed after 13 seconds:
https://github.com/user-attachments/assets/0a1c2862-a259-4724-80fe-c3116fe73c47
What I found:
- When the answer lands, LegendList starts a smooth
scrollToEnd(the animatedmaintainScrollAtEndused while a turn works). Chrome takes about 1.5s to scroll 14,000px. - About 0.7s in, the turn ends and a row above the viewport shrinks by roughly 37px. LegendList keeps the visible content in place with an instant
scrollBy, and in the browser an instant scroll cancels a smooth one in flight. Its guard against that (shouldSkipAdjustForMaintainedEnd) only covers the first 500ms of an animated maintain. - LegendList only re-pins within
maintainScrollAtEndThreshold× viewport of the end (T3 passes 1), so it gives up. useTimelineFollow'sonIsAtEndChangeignores "left the end" while following, because the list leaves the end for a frame on every streamed chunk. So nothing in T3 re-pins either, and the pill never appears.
In a scripted repro (Replay dev provider, the answer delivered in one update, turn ending right after), the chat stopped short in 10 of 10 runs at 56–57 fps. A control where the turn kept working 4 seconds longer reached the bottom in 5 of 5.
Impact
- [x] Major degradation or frequent failure
Version or commit
main at 5fe18d79ac
Environment
Windows 11, web app from vp run dev in Chromium (also seen with Claude in the dev server).
Workaround
Scroll down by hand. The "Scroll to end" pill doesn't appear, because T3 still thinks it is following.
This is the same problem as #28125, so I'm closing it in favour of that one. If it is different, say how and it will be reopened.