You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an agent started a thread and the only human message is a mid-turn steer, one click on Load earlier keeps fetching pages past that steer. The server deliberately leaves hasEarlierUserMessage off for a page that holds a human steer with no older human turn start. But the shared client fallback only stops at turn starts and notifications, so it reads that page as having no stopping point. The helper is used by normal thread history, linked-thread history, and web guest history.
Deterministic repro on origin/main (3e0f458c13141fb4056c6c349331d0253cc8546c): build 500 ordered local projected rows in one run. Row 0 is an agent user_message (inputIntent: "turn_start"), row 300 is a human user_message (createdBy: "user", inputIntent: "steer"), and every other row is an assistant_message. At snapshotSequence: 1, call selectRecentTimelineWindow, then selectHistoryPageFromCursor with its nextCursor, then pass that page with EMPTY_EARLIER_HISTORY_CONTINUATION_BUDGET to nextEarlierHistoryContinuationBudget.
Observed: a 75-row snapshot, then an older page from item-275 to item-424 that contains item-300, with hasMoreHistory: true and no hasEarlierUserMessage. The helper returns { pages: 1, items: 150, … }. In the app, ChatView's Load earlier (ChatView.tsx:608 → threadCommands.ts:147) runs the shared loader loop in threads.ts:866. It uses that budget to set keepPaging (threads.ts:890-893), merges each page into visibleTurnItems (threads.ts:943-954), and moves on to page.nextCursor (threads.ts:971-973). So the same click keeps fetching and merging older pages until it reaches the agent turn start at row 0, and all of the older history appears at once.
Expected: it returns null, so the loader stops after merging rows 275–424. Their nextCursor stays in history.historyCursor, so the next click loads the older rows.
Change
When the server sends no hasEarlierUserMessage hint, nextEarlierHistoryContinuationBudget now also stops at any human-created user_message, in addition to the existing turn-start and notification boundaries. A positive hasEarlierUserMessage still wins, so paging continues past a steer when an older human turn exists. Normal, linked-thread, and guest history all use this shared helper, so web, desktop, and mobile get the fix. It does not depend on the provider.
Scope
Small fix for an obvious bug; no issue needed under CONTRIBUTING.md.
Verification
New regression case stops at a human steer unless the server reports an earlier user turn in packages/client-runtime/src/state/threadHistoryMerge.test.ts. On base it fails with expected { pages: 1, items: 3, bytes: 1613 } to be null. On head it passes, along with the other 20 tests in the file.
I ran the 500-row fixture above through the real server selectors and the shared client helper. Before: continuationBudget: { pages: 1, items: 150, … } (fetches again). After: continuationBudget: null (stops). Transcript: https://gist.github.com/saphid/45cf21562dcd16475f9c407f38668922
vp run check:changed on head 7100ec244525857c1eabefae2d341b3e80daf7ec exits 0: format, lint, knip, typecheck (7 packages), and tests all pass. The output is in the gist, along with the loader trace above.
Not shown: a scenarios:prove Replay run that clicks Load earlier once, counts the history requests and checks that a second click loads older rows. The loader behaviour is traced from source, not recorded. Also not shown: device or mobile runs and a full CI suite run.
Authored by Claude Opus 5.5 (Model Hub); reviewed by GPT-6.2 Sol (Codex).
Not shown
.github/pull_request_template.md:20 — The source trace proves the observable difference, but no Replay run records it. Capture the extra history requests on base and the retained Load earlier control on head, then show that a second click loads the older rows. Replace ‘all of the older history appears at once’ with ‘the same click keeps fetching and merging older pages’; rendering can fold rows and the merges are incremental.
.github/pull_request_template.md:20 — The gist identifies the reviewed head and summarizes check:changed as passing, but does not include the command output or exit status. Attach the log or describe the gist as a summary rather than as attached command output.
Macroscope's review found this PR approvable — Earlier-history loading now stops at a human steer when no earlier user message is indicated. The change only limits automatic pagination, preserves existing load bounds, and does not modify stored history.
Notes:
All code in this push has already been reviewed. Approvability was decided on eligibility alone.
You can add or adjust custom eligibility rules. Learn more.
Reviewing files that changed from the base of the PR and between e030e42 and 609e993.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
The continuation budget now stops when a page contains a turn-starting item or a user-created user_message. Paging tests cover when hasEarlierUserMessage allows continuation through earlier pages.
The continuation check treats a user-created user_message as a stopping boundary. Tests cover the hasEarlierUserMessage exception and paging behavior for agent-started turns, notifications, and human steers. The documentation names a human steer as a boundary.
This change makes Load earlier stop at a human steer unless the server says an earlier user turn exists. It is a small, client-side, easily reversible behavior fix with regression tests. No merge-blocking risk was identified.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the actual change: Load earlier history now stops at a lone human steer in client-runtime. It uses a conventional commit prefix and is specific. It is 71 characters, within a reasonabl…
Description check
The description follows the template. It has Problem, Change, Scope, and Verification sections. The problem has a clear repro with expected and observed behavior. The change explains the shared helper…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the actual change: Load earlier history now stops at a lone human steer in client-runtime. It uses a conventional commit prefix and is specific. It is 71 characters, within a reasonable length for a title.
Full details: Description check
Explanation
The description follows the template. It has Problem, Change, Scope, and Verification sections. The problem has a clear repro with expected and observed behavior. The change explains the shared helper and the positive hint case. Scope justifies no linked issue as a small obvious bug fix. Verification lists a regression test, a fixture run, and a check:changed run on a specific head. It states what was not shown, including the Replay run and device tests. The template also asks for the model and harness used. The description names the authoring model, so this item is covered. The gist does not include the check command output, which the verification section should clarify. These are minor gaps, so the description is mostly complete.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
…helper case
The loader test already covers both a lone steer and a steer with an earlier human turn.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Environment on both sides: Linux web client, Chromium 156, 1280×800, light theme, fresh isolated database, synthetic project, real Replay (dev) provider.
Created a synthetic project and launched an agent-owned Replay (dev) Long stream thread through the real CLI. At step 100, sent 'HUMAN STEER: also check the tests' in the web composer. Waited for 85 further replay steps (Replay restarts numbering after a steer), then pressed Stop. Reopened the thread through a full page navigation, waited for the timeline, scrolled to the top, and clicked Load earlier turns once. On head, clicked it a second time and waited for the original agent prompt to become available.
Base reproduced the overshoot; head retained the control after the first click. The second head click made the original agent prompt available. The real-app scenario failed its history-control assertion on base and passed on head.
The comparison wrapper exited with code 143 after base completed; its existing head worker continued and completed successfully. Results were paired from the completed base and head reports.
Not shown:
Positive hasEarlierUserMessage continuation was not exercised; this scenario covers the lone-human-steer boundary with no earlier human turn.
Mobile and Electron shell were not run; evidence covers the web client.
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
size:XS0-9 changed lines (additions + deletions).vouch:trustedAuthor is trusted by repo permissions or the VOUCHED list.
2 participants
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.
Problem
When an agent started a thread and the only human message is a mid-turn steer, one click on Load earlier keeps fetching pages past that steer. The server deliberately leaves
hasEarlierUserMessageoff for a page that holds a human steer with no older human turn start. But the shared client fallback only stops at turn starts and notifications, so it reads that page as having no stopping point. The helper is used by normal thread history, linked-thread history, and web guest history.Deterministic repro on
origin/main(3e0f458c13141fb4056c6c349331d0253cc8546c): build 500 ordered local projected rows in one run. Row 0 is an agentuser_message(inputIntent: "turn_start"), row 300 is a humanuser_message(createdBy: "user",inputIntent: "steer"), and every other row is anassistant_message. AtsnapshotSequence: 1, callselectRecentTimelineWindow, thenselectHistoryPageFromCursorwith itsnextCursor, then pass that page withEMPTY_EARLIER_HISTORY_CONTINUATION_BUDGETtonextEarlierHistoryContinuationBudget.item-275toitem-424that containsitem-300, withhasMoreHistory: trueand nohasEarlierUserMessage. The helper returns{ pages: 1, items: 150, … }. In the app, ChatView's Load earlier (ChatView.tsx:608→threadCommands.ts:147) runs the shared loader loop inthreads.ts:866. It uses that budget to setkeepPaging(threads.ts:890-893), merges each page intovisibleTurnItems(threads.ts:943-954), and moves on topage.nextCursor(threads.ts:971-973). So the same click keeps fetching and merging older pages until it reaches the agent turn start at row 0, and all of the older history appears at once.null, so the loader stops after merging rows 275–424. TheirnextCursorstays inhistory.historyCursor, so the next click loads the older rows.Change
When the server sends no
hasEarlierUserMessagehint,nextEarlierHistoryContinuationBudgetnow also stops at any human-createduser_message, in addition to the existing turn-start and notification boundaries. A positivehasEarlierUserMessagestill wins, so paging continues past a steer when an older human turn exists. Normal, linked-thread, and guest history all use this shared helper, so web, desktop, and mobile get the fix. It does not depend on the provider.Scope
Small fix for an obvious bug; no issue needed under CONTRIBUTING.md.
Verification
stops at a human steer unless the server reports an earlier user turninpackages/client-runtime/src/state/threadHistoryMerge.test.ts. On base it fails withexpected { pages: 1, items: 3, bytes: 1613 } to be null. On head it passes, along with the other 20 tests in the file.continuationBudget: { pages: 1, items: 150, … }(fetches again). After:continuationBudget: null(stops). Transcript: https://gist.github.com/saphid/45cf21562dcd16475f9c407f38668922vp run check:changedon head7100ec244525857c1eabefae2d341b3e80daf7ecexits 0: format, lint, knip, typecheck (7 packages), and tests all pass. The output is in the gist, along with the loader trace above.Not shown: a
scenarios:proveReplay run that clicks Load earlier once, counts the history requests and checks that a second click loads older rows. The loader behaviour is traced from source, not recorded. Also not shown: device or mobile runs and a full CI suite run.Authored by Claude Opus 5.5 (Model Hub); reviewed by GPT-6.2 Sol (Codex).
Not shown