GeezerVison is showing github.com — fix(client-runtime): load earlier history through folded activity by ln-bodicherla · Pull Request #21957 · pingdotgg/t3code
Conversation
Clicking "Load earlier turns" can appear to do nothing when a long completed run spans several history pages. Each click loads one slice, but the new activity stays inside the same collapsed "Worked for" group.
Keep loading until a page reaches a prompt, a notification boundary, or the end of history. Each request keeps the existing server limits. The loading indicator stays active between pages, and a failed request can be retried from the last successful cursor. Targeted history lookups keep their existing behavior.
Fixes #21821, which was accepted as a bug. This change is limited to the shared history loader and its tests. Related PR #21476 touches the same area but does not address this case.
84 focused tests pass. Coverage includes a 531-row history with a large output, empty pages, inherited history, turn boundaries, partial failure and retry, timeouts, concurrent clicks, cursor loops, cancellation, and replacement snapshots. The long-history regression fails against the original loader after one request and passes with eight bounded requests. Scoped lint and client-runtime typecheck also pass.
Before · After
The screenshots use the real timeline component with controlled history fixtures in Chromium. The HTTP loader was tested separately. Native clients, live provider sessions, and remote transport were not exercised. Very long histories without a boundary can still require many sequential requests.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Approvability
Verdict: Needs Human Approval
Macroscope's review found this PR requires human approval — The production history loader now automatically performs multiple sequential requests and merges pages based on data-dependent boundaries, while also changing loading, interruption, retry, and cursor-loop behavior. Despite strong focused test coverage and a localized diff, this is a material existing-path runtime change that merits human review.
Notes:
- Code review disabled. Approvability was decided on eligibility alone.
You can add or adjust custom eligibility rules. Learn more.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|

No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Advanced
- Run ID:
c8724bcb-75ad-42d5-a005-865423d5e716
📥 Commits
-
Reviewing files that changed from the base of the PR and between 54983e3 and ddefd93.
📒 Files selected for processing: 2
-
packages/client-runtime/src/state/threads-sync.test.ts
packages/client-runtime/src/state/threads.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
📝 Walkthrough
-
loadEarlier now continues across eligible history pages until it reaches a user-turn boundary or exhausts history. It also checks cursor progression and request ownership. Tests cover long histories, retries, errors, and concurrent state changes.
Changes: Progressive history loading
| Layer / File(s) |
Summary |
Continue paging through agent-started history packages/client-runtime/src/state/threads.ts, packages/client-runtime/src/state/threads-sync.test.ts |
When a complete page has more history and no notification or turn-start/queued-turn user message, loadEarlier requests another page. Tests cover varied page contents, long histories, and stopping at a user-turn boundary. |
Track cursor and request ownership packages/client-runtime/src/state/threads.ts, packages/client-runtime/src/state/threads-sync.test.ts |
The loader stops if progressive history metadata changes and reports an error for repeated, cyclic, or missing cursors. Tests cover timeout, retry, interruption, replacement, deletion, and concurrent loads. |
Priority: ➖ Normal
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Bug fix · Severity of issue fixed: Medium
Suggested reviewers: juliusmarminge, noojuno
Merge Risk: ⚪ Minimal · up to ddefd
-
This change makes "Load earlier turns" continue through folded activity until it reaches a boundary. Tests cover the main failure and retry cases. No merge-blocking risk was found. Very long histories without a boundary may take many sequential requests.
Security architecture risk: 🔵 Low · up to ddefd
-
The inspected changes preserve existing access controls and contain interrupted or failed requests. One loading action can now retrieve many pages, increasing resource use for exceptionally long histories.
Retained concerns
No architecture-level concerns identified.
Security review details
-
Security Blast Radius
- inferred — The changed flow increases automatic reads and accumulated history for the selected environment and thread projection, including inherited rows returned for that projection. The inspected path does not add tenant, environment, credential, or tool authority; it increases the amount of work performed under existing authority.
Trust Boundaries and Controls
- observed — Every continued page uses the existing authenticated HTTP helper. That helper retains cookie, bearer, or DPoP handling; DPoP authorization requests name the expected environment, and proofs bind the method and constructed URL. The endpoint declaration retains authentication middleware. Server-side enforcement was not independently inspected.
Resilience and Maintainability Implications
- observed — Requests remain sequential, each history request has a six-second default timeout, and repeated, cyclic, or missing continuation cursors cause an error. These controls contain stalled requests and cursor loops, but do not impose an aggregate page, byte, or duration budget across distinct advancing cursors. This is a resource-containment tradeoff, not an established denial-of-service finding.
Hardening Proposals
- proposed — Consider an aggregate continuation budget that pauses with the last successful cursor preserved. This would bound per-action work for unusually large boundary-free histories without changing access controls or discarding partial progress.
Pre-merge checks: 4
-
| Check name |
Status |
Explanation |
| Title check |
 |
The title is concise, uses the repository's conventional format, and accurately describes the main change: loading earlier history through folded activity. |
| Description check |
 |
The description covers the problem, implementation, scope, linked issue, verification results, test coverage, screenshots, and known limitations. It provides enough detail to evaluate the change. |
| Linked Issues check |
 |
Issue #21821 requires each "Load earlier turns" action to reveal earlier history across activity-only pages while retaining the existing request budget. In `packages/client-runtime/src/state/threads.t… |
| Out of Scope Changes check |
 |
The whole-PR changes are limited to the shared history loader in packages/client-runtime/src/state/threads.ts and its tests in packages/client-runtime/src/state/threads-sync.test.ts. The added tes… |
Full details: Linked Issues check
-
Explanation
Issue #21821 requires each "Load earlier turns" action to reveal earlier history across activity-only pages while retaining the existing request budget. In packages/client-runtime/src/state/threads.ts, loadEarlier continues with the returned cursor when a complete page has more history and has no notification or turn_start/queued_turn user-message boundary. It keeps loading active between pages, preserves the cursor after failure, rejects cursor loops, and preserves targeted lookup behavior. Tests cover the 531-row, byte- and row-bounded regression and the stated boundary, retry, timeout, cancellation, and snapshot cases.
Full details: Out of Scope Changes check
-
Explanation
The whole-PR changes are limited to the shared history loader in packages/client-runtime/src/state/threads.ts and its tests in packages/client-runtime/src/state/threads-sync.test.ts. The added tests verify the linked issue behavior and related loader safety. The targeted-lookup test update preserves existing behavior. No unrelated product area or non-supporting change is shown.
✨ Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Closing in favour of #24417, which makes the same change. Thanks for the work here!
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
size:M
30-99 changed lines (additions + deletions).
vouch:unvouched
Author is not yet trusted in the VOUCHED list.
Milestone
No milestone
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.
|