Repository navigation
Conversation
…urn opener Scrolling up in a long chat stopped at the initial window and never fetched or rendered more history. Two causes in ChatList: 1. The session-reset effect ran on mount too, blanking windowRef after the window memo had already produced the first window. requestOlderHistory then read a zero-length window and bailed until some later message change re-ran the memo, so a freshly opened chat that received no new message could not page at all. The reset now runs only when the session id actually changes. 2. When a server page landed without a renderable turn boundary (a long agent turn whose user prompt is still on the server), the resume effect kept awaitingOlderRef raised with nothing in flight, and every later drag returned early on that flag. It now requests the next page while pages keep arriving, and re-arms the drag when a fetch brought nothing. Both were masked before: every incoming socket message re-invalidated the session and re-ran the five-page background prefetch, which filled the store behind the list's back. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Scrolling up in a long chat can stop at the initial 60-message window: nothing older renders and nothing is fetched, even though the server has more history. Two latent bugs in
sources/components/ChatList.tsx:windowRefright after the window memo produced the first window for this render, sorequestOlderHistoryreads a zero-length window (currentEnd === 0) and bails until some later message change re-runs the memo. A freshly opened chat that receives no new message cannot page its own history in.windowEndForTurnfinds no user prompt to cut at (a long agent turn whose prompt is still on the server), the resume effect keepsawaitingOlderRefraised with nothing in flight, and every later drag returns early on that flag. The chat ends there for good.Both were masked on
mainby a side effect: every incoming socket message re-invalidates the session (handleUpdate→onSessionDataUpdated), which re-runs the five-page background prefetch and fills the store behind the list's back. #1801 removes that per-message refresh, which is how these surfaced; the fix stands on its own and is worth having regardless.Changes
ChatList.paging.test.ts: drives layout/scroll events through a captured FlashList mock and asserts paging on open, across a no-opener page, and after an empty fetchTest plan
pnpm typecheck(clean)pnpm exec vitest run sources/components/ChatList.paging.test.ts sources/components/ChatList.test.ts(14 passed; all 3 new tests fail against the currentChatList.tsx)Related: #1813 (long-lived web tab), #1801.
🤖 Generated with Claude Code