GeezerVison is showing github.com — fix(server): enforce history page limits at turn boundaries by connwalk · Pull Request #15794 · pingdotgg/t3code
Conversation
connwalk
commented
Oct 4, 2026
•
edited by juliusmarminge
Loading
Uh oh!
There was an error while loading. Please reload this page.
Histories with user-created turn anchors bypassed item and byte budgets, producing oversized pages. Paging now applies the default 75-item / 1 MiB budgets at complete-turn boundaries, preserving user-turn and raw-turn ceilings. The newest complete turn is always admitted so oversized turns cannot stall loading; these are admission budgets, not an absolute frame-size cap.
Rebuilt on current main with a backward scan and one final slice, replacing the original unbounded spread and repeated prepending. SQL history pages account for actual wire payloads while retaining the full history's notification and steering context. The legacy WebSocket snapshot also requests a turn-aligned SQL window, preserving nested-fork history continuity. Histories with no user-created anchor retain row-based paging. Queued-message boundaries remain unchanged, and find jumps may require more bounded pages.
Credit to @connwalk for #15794, whose original commits are preserved. Maintainer batch usage-billing-04 explicitly authorizes applying budgets to anchored histories, answering the earlier policy question. Takeover claim.
Verification:
- 208 focused tests pass across 14 files, covering SQL/helper parity, independent budgets, lossless cursor traversal, a 150,000-row oversized turn, notification and same-run steering boundaries, queued suffixes, nested forks, bounded-snapshot duplicate local-item accounting, transport, and shared client history. Scoped lint, formatting, and server typecheck pass.
- A running server with isolated SQLite state served a synthetic 20-turn / 200-row thread containing 20,000-byte outputs through authenticated HTTP. The initial bounded snapshot contained 20 rows; following its history cursor returned pages of 50, 50, 50, and 30 rows. All 200 identities were recovered in order without duplicates or gaps, ending with a null cursor. The largest history response was 925,942 bytes. HTTP verification results.
- A separate headless comparison using the actual paging helper returned 100 rows / 1,822,411 encoded bytes on main versus 50 rows / 911,201 bytes with this change. The SQL integration cases additionally verify a 201-row notification turn and an oversized queued turn containing same-run steering stay whole.
The original iPhone-to-Mac reconnect, WebSocket reconnect, packaged Electron, macOS, Windows, iOS, and Android were not exercised on this Linux machine. No UI screenshot applies to this server-only change.
Implementation: gpt-6.1-sol through Codex. Tests: gpt-6-astra through Codex. Adversarial review: claude-opus-5-5 through Claude Code and gpt-6-sol through Codex.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Timelines with turn anchors skipped the 75-item and 1 MiB page budgets, so a
long thread could send a very large history page to mobile clients. Apply every
limit at turn boundaries instead, keeping turns intact and always admitting the
newest turn so an oversized turn cannot stall paging.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.
Approvability
Verdict: Would Approve
Macroscope's review found this PR approvable — This is a focused server-side bug fix that enforces existing history page limits without schema or configuration changes, and it includes targeted coverage. An unresolved High finding identifies a possible argument-limit failure for oversized turns, which remains a mandatory approval blocker.
Not approved because:
- 1 blocking correctness issue found at or above your repo's Minimum Blocking Severity
Adjust the Minimum Blocking Severity for this repo — including turning it Off — in Settings. 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.
coderabbitai
Bot
commented
Oct 4, 2026
•
edited
Loading
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: Repository: pingdotgg/t3code/.coderabbit.yaml
- Review profile: CHILL
- Plan: Advanced
- Run ID:
72d9a898-f054-4a55-b8f9-99ed9bc72fc8
📥 Commits
-
Reviewing files that changed from the base of the PR and between efecd3c and 875b028.
📒 Files selected for processing (2)
-
apps/server/src/orchestration-v2/threadHistoryPaging.test.ts
apps/server/src/orchestration-v2/threadHistoryPaging.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
📝 Walkthrough
-
selectOlderTimelinePage now applies item and byte budgets at complete turn boundaries for anchored histories. It always includes the newest turn, even when that turn exceeds the configured limits. Histories without user turns retain row-by-row selection and include at least one row.
Changes: Anchored history paging
| Layer / File(s) |
Summary |
Apply paging limits at turn boundaries apps/server/src/orchestration-v2/threadHistoryPaging.ts, apps/server/src/orchestration-v2/threadHistoryPaging.test.ts |
Anchored histories are selected by complete turns and constrained by item, byte, user-turn, and raw-turn limits. Tests cover turn-boundary budgets, oversized newest turns, and bounded snapshots using duplicated local-row costs. |
Priority: ➖ Normal
Estimated code review effort: 2 (Simple) | ~15 minutes
Change: Bug fix
Suggested reviewers: bil0000
Merge Risk: ⚪ Minimal · up to 875b0
-
History pages retain complete turns while limiting older history. No actionable merge-blocking issue remains after normal checks.
Pre-merge checks: 4 · 1
-
Failed checks: 1 warning
| Check name |
Status |
Explanation |
Resolution |
| Docstring Coverage |
 |
Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 2 files. |
Write docstrings for the functions missing them to satisfy the coverage threshold. |
Passed checks: 4 passed
-
| Check name |
Status |
Explanation |
| 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. |
| Title check |
 |
The title clearly and concisely describes the main change: enforcing history page limits at turn boundaries. |
| Description check |
 |
The description explains the problem, implementation, scope approval, and detailed verification results. It does not use separate Problem, Change, or Scope and approval headings, but the required info… |
Full details: Description check
-
Explanation
The description explains the problem, implementation, scope approval, and detailed verification results. It does not use separate Problem, Change, or Scope and approval headings, but the required information is present and the description is sufficiently complete.
- Fix all pre-merge checks with AI
✨ Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Autopilot · 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.
Note Written by claude-opus-5-5 on behalf of Maria
Hi! We are cleaning up open PRs, and this one names a harness (Claude Code) but not which model version created it. If this change is really important, we recommend rebuilding the PR with a newer model and noting the model in the PR description.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Note Written by claude-opus-5-5 on behalf of Maria
Reopening, this was closed by mistake. Sorry for the noise!
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Note This comment is posted by Julius' dot
Could a maintainer confirm the intended paging constraint here? The old comment in threadHistoryPaging.ts explicitly limits item/byte budgets to histories without turn starts, while this patch applies those budgets at anchored turn boundaries. The regression tests establish the new limit behavior, but the PR's claim that anchored budgets were already intended conflicts with that documented choice. Under problem and scope, please link the intended-behavior decision or explain why this preserves the original constraint. Leaving this open for that clarification and maintainer decision.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Oct 13, 2026
|
Taking over this one as part of maintainer batch usage-billing-04. I will rebuild the paging fix on current main, preserve complete-turn paging and notification boundaries, and push focused tests and implementation updates here. Thanks @connwalk for the reproduction and initial fix.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
We hit the same bypass on a real OpenCode thread and can confirm the userTurnStarts < maxUserTurns case, which I think is the residual case after #17433.
Thread shape (server 0.1.0, main @ 8fc72da):
- 1,116 turn items / 3.82 MB
- 6 user-created turn starts (ordinals 1, 3, 4, 8, 9, 10), fewer than
maxUserTurns: 10
- run 1: 409 items / 1.375 MB, including four 2880x2420 / 2880x1302 PNG embeds
- run 4: 190 items / 0.879 MB
- run 7: 321 items / 1.055 MB
- run 10: 136 items / 0.330 MB
In ProjectionStore.ts:2946, user_anchors is non-empty, so the query uses LIMIT -1. The boundary is ordinal 0 because the thread has fewer than 10 user turns. In threadHistoryPaging.ts:236, turnLimit is then set to 10 and rowBytes is forced to 0, so maxItems and maxEncodedBytes are never checked. The initial bounded snapshot contains the entire thread. payloadBudgetExceeded is true, but the body is not trimmed.
Client impact: Android 16 / 23090RA98G / T3 Code Mobile 2.0.0 freezes on open. The phone's GET /api/orchestration/threads/<id>/bounded?compactTurnItems=1 took 607 ms and the server-side subscribeThread snapshot took 1.1 ms; the client then requested the four run-1 images and went silent until it was force-closed. A desktop Electron client on the same thread opens it in ~200 ms, so this only surfaces on the mobile client.
The 75-item / 1 MiB admission budgets in this PR would make the initial snapshot the newest 136-item / 0.33 MB turn instead of all 1,116 items, and would keep run 1's images out of the first mount. That matches the expected behavior.
Would a regression fixture with 6 user turns and ~1,100 items / 3.8 MB be useful? I can provide a synthetic one (not the real database). Also, the branch is currently dirty against 8fc72da; happy to test a rebased build against this thread if that helps.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Note 🤖 Claude Opus 5.5 responding on behalf of Theo
Superseded by #24589. Every history window now stops at the 1 MiB byte budget, and windows with user turns also stop at 500 rows, so anchored histories no longer bypass the budgets.
|
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.
Labels
size:L
100-499 changed lines (additions + deletions).
vouch:unvouched
Author is not yet trusted in the VOUCHED list.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|