Skip to content
Source
Sign inSign up

test(server): windowed history pages are checked against the full index at the window edges #35877

Mergedt3dotgg(GitHub profile, opens in a new tab)merged 2 commits intomain fromrefs/pull/35877/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

An independent review of #34573 planted 23 bugs in the windowed history read. Four of them change a page a client can request and still passed every test. They still pass on main today, after #35405. A fifth was caught at the review and stopped being caught later: #23420 added a kind to the generated list, which shifted the seeded values.

The generated test a page read from a window equals the page read from the full index now catches all five. Each page is still compared with the page the full index returns for the same request, so there are no hand-written expected values. No product code changes.

A new fifth thread puts three things below one window:

  • a user turn under a hidden queued turn
  • the start of a long run that folds
  • the start of the run before it, which has later rows among the first rows of the long run

The fourth thread now has a fixed late notification. It is a turn, then many rolled-back rows, then a late notification of that turn, then 149 one-row turns. One page ends with exactly those 149 turns above the notification.

Planted bugFailing requestWindow pageFull-index page
No read of a folded run below the windowFifth thread: first work-folding page, from the newest row500 rows, long run not folded500 rows, both runs folded
Rows below the trusted bound are trustedFifth thread: first work-folding page, from the newest row500 rows, older run not folded500 rows, both runs folded
A user turn below the window is ignoredFifth thread: work-folding page that ends at the reply deep in the stopped run75 rows309 rows, back to the first user turn
olderUserTurn reads one rowFifth thread: work-folding page that ends at the reply deep in the stopped run75 rows309 rows, back to the first user turn
No startedRuns (a late notification counted as a turn)Fourth thread: work-folding page that ends at the active run150 rows, stops at the notification244 rows, back to the turn start

Each bug was planted locally and never committed. Before this change, all 85 tests in ProjectionStore.test.ts and threadHistoryPaging.test.ts passed with each one. Now each one fails this test. The two threads do not depend on the seed: with eight other seeds they caught all five.

Of the 23 planted bugs, the tests now catch 19. The other four are the ones the review reported as not caught.

The test goes from about 770 ms to about 940 ms.

Created with Claude Fable 5.2 in Claude Code (T3 Code).

🤖 Generated with Claude Code

    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. Approvability

      Verdict: Approved at 77de3cb

      Macroscope's review found this PR approvable — This change expands history-pagination window-edge tests within an ignored test file. It does not change production behavior or introduce material operational risk.

      Notes:

      • No code objects were reviewed. Approvability was decided on eligibility alone.
      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. Thread transfer impact

      ✅ Thread transfer remains within every enforced ceiling.

      ProviderMetricMain baselineThis PRImpactPR ceiling
      CodexTotal thread wire5.0 KiB5.0 KiB0 B (0.0%)6.8 KiB✅
      CodexThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiB✅
      CodexLive turn WebSocket wire1.2 KiB1.2 KiB0 B (0.0%)2.0 KiB✅
      CodexLive turn WebSocket decoded21.5 KiB21.5 KiB0 B (0.0%)24.4 KiB✅
      CodexLive turn messages110 (0.0%)8✅
      ClaudeTotal thread wire5.0 KiB5.0 KiB0 B (0.0%)6.8 KiB✅
      ClaudeThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiB✅
      ClaudeLive turn WebSocket wire1.2 KiB1.2 KiB0 B (0.0%)2.0 KiB✅
      ClaudeLive turn WebSocket decoded21.9 KiB21.9 KiB0 B (0.0%)24.4 KiB✅
      ClaudeLive turn messages110 (0.0%)8✅

      Other scenarios

      All 64 scenario measurements match main.

      All 64 scenario measurements
      ProviderScenarioMetricMain baselineThis PRImpactPR ceiling
      Codexshort turn resumeWebSocket decoded10.5 KiB10.5 KiB0 B (0.0%)12.7 KiB✅
      Codexshort turn resumeWebSocket messages220 (0.0%)2✅
      Codexlong turn running, cold openHTTP decoded281.7 KiB281.7 KiB0 B (0.0%)302.7 KiB✅
      Codexlong turn running, cold openrows75750 (0.0%)75✅
      Codexlong turn running, history pageHTTP decoded92.4 KiB92.4 KiB0 B (0.0%)107.4 KiB✅
      Codexlong turn running, history pagerows75750 (0.0%)75✅
      Codexlong turn finished, cold openHTTP decoded381.5 KiB381.5 KiB0 B (0.0%)410.2 KiB✅
      Codexlong turn finished, cold openrows1511510 (0.0%)151✅
      Codexlong turn finished, socket cold openWebSocket decoded381.6 KiB381.6 KiB0 B (0.0%)410.2 KiB✅
      Codexlong turn finished, socket cold openWebSocket messages220 (0.0%)2✅
      Codexlong turn finished, socket cold openrows1511510 (0.0%)151✅
      Codexlong turn finished, work pageHTTP decoded186.2 KiB186.2 KiB0 B (0.0%)200.2 KiB✅
      Codexlong turn finished, work pagerows1501500 (0.0%)150✅
      Codexidle thread resumeWebSocket decoded65 B65 B0 B (0.0%)200 B✅
      Codexidle thread resumeWebSocket messages110 (0.0%)1✅
      Codexfleet shell snapshotHTTP decoded42.4 KiB42.4 KiB0 B (0.0%)53.7 KiB✅
      Codexfleet shell snapshotrows27270 (0.0%)27✅
      Codexfleet shell subscribeWebSocket decoded65 B65 B0 B (0.0%)200 B✅
      Codexfleet shell subscribeWebSocket messages110 (0.0%)1✅
      Codexfleet shell resume checkHTTP decoded18 B18 B0 B (0.0%)100 B✅
      Codexfleet shell resume checkrows0000✅
      Codexstale shell reloadHTTP decoded42.4 KiB42.4 KiB0 B (0.0%)53.7 KiB✅
      Codexstale shell reloadrows27270 (0.0%)27✅
      Codexstale shell resumeWebSocket decoded140 B140 B0 B (0.0%)400 B✅
      Codexstale shell resumeWebSocket messages220 (0.0%)2✅
      Codexstale todo list cold openHTTP decoded72.4 KiB72.4 KiB0 B (0.0%)83.0 KiB✅
      Codexstale todo list cold openrows75750 (0.0%)75✅
      Codexstale todo list cold opennodes220 (0.0%)4✅
      Codexstale todo list cold opensubagents220 (0.0%)4✅
      Codexstale todo list cold openplans110 (0.0%)2✅
      Codexstale todo list cold openproviderTurns110 (0.0%)2✅
      Codexstale todo list cold opencheckpoints110 (0.0%)2✅
      Claudeshort turn resumeWebSocket decoded10.6 KiB10.6 KiB0 B (0.0%)12.7 KiB✅
      Claudeshort turn resumeWebSocket messages220 (0.0%)2✅
      Claudelong turn running, cold openHTTP decoded283.3 KiB283.3 KiB0 B (0.0%)302.7 KiB✅
      Claudelong turn running, cold openrows75750 (0.0%)75✅
      Claudelong turn running, history pageHTTP decoded93.4 KiB93.4 KiB0 B (0.0%)107.4 KiB✅
      Claudelong turn running, history pagerows75750 (0.0%)75✅
      Claudelong turn finished, cold openHTTP decoded384.2 KiB384.2 KiB0 B (0.0%)410.2 KiB✅
      Claudelong turn finished, cold openrows1511510 (0.0%)151✅
      Claudelong turn finished, socket cold openWebSocket decoded384.3 KiB384.3 KiB0 B (0.0%)410.2 KiB✅
      Claudelong turn finished, socket cold openWebSocket messages220 (0.0%)2✅
      Claudelong turn finished, socket cold openrows1511510 (0.0%)151✅
      Claudelong turn finished, work pageHTTP decoded188.1 KiB188.1 KiB0 B (0.0%)200.2 KiB✅
      Claudelong turn finished, work pagerows1501500 (0.0%)150✅
      Claudeidle thread resumeWebSocket decoded66 B66 B0 B (0.0%)200 B✅
      Claudeidle thread resumeWebSocket messages110 (0.0%)1✅
      Claudefleet shell snapshotHTTP decoded43.0 KiB43.0 KiB0 B (0.0%)53.7 KiB✅
      Claudefleet shell snapshotrows27270 (0.0%)27✅
      Claudefleet shell subscribeWebSocket decoded66 B66 B0 B (0.0%)200 B✅
      Claudefleet shell subscribeWebSocket messages110 (0.0%)1✅
      Claudefleet shell resume checkHTTP decoded18 B18 B0 B (0.0%)100 B✅
      Claudefleet shell resume checkrows0000✅
      Claudestale shell reloadHTTP decoded43.0 KiB43.0 KiB0 B (0.0%)53.7 KiB✅
      Claudestale shell reloadrows27270 (0.0%)27✅
      Claudestale shell resumeWebSocket decoded140 B140 B0 B (0.0%)400 B✅
      Claudestale shell resumeWebSocket messages220 (0.0%)2✅
      Claudestale todo list cold openHTTP decoded73.4 KiB73.4 KiB0 B (0.0%)83.0 KiB✅
      Claudestale todo list cold openrows75750 (0.0%)75✅
      Claudestale todo list cold opennodes220 (0.0%)4✅
      Claudestale todo list cold opensubagents220 (0.0%)4✅
      Claudestale todo list cold openplans110 (0.0%)2✅
      Claudestale todo list cold openproviderTurns110 (0.0%)2✅
      Claudestale todo list cold opencheckpoints110 (0.0%)2✅

      Baseline: 95cb068 · PR result: 77de3cb · Source CI: success

      Scenario and decoded snapshot size

      10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

      • Codex decoded thread snapshot: 108.5 KiB
      • Claude decoded thread snapshot: 108.8 KiB

      Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

    4. Explain Change →

      No actionable comments were generated in the recent review.

      Walkthrough

      The window-equivalence test now runs five rounds. It adds cases for cancelled queued turns, long folded runs, late wake notifications, and overlapping run ownership. Page-read checks now use recorded page-end item IDs.

      Changes: Projection window-equivalence test

      Layer / File(s)Summary
      Generated histories and page checks
      apps/server/src/orchestration-v2/ProjectionStore.test.ts
      The test adds a fifth-round run mix and changes the fourth-round history to include a rolled-back run, a late wake, and 149 one-row runs. It adds long-fold work rows and adjusts run ownership, wake selection, and assistant replies. Page-read checks use recorded page-end item IDs.

      Estimated code review effort: 2 (Simple) | ~10 minutes

      Change: Other

      Possibly related PRs

      • pingdotgg/t3code#33305: Changes the thread snapshot window query, which the expanded window-equivalence tests exercise at folded-group and user-turn boundaries.
      • pingdotgg/t3code#35405: Changes history paging behavior at kept-row boundaries, which is related to the test’s page-boundary checks.

      Suggested reviewers: alb11747, juliusmarminge

      Merge Risk: Minimal · up to 77de3

      This PR only adds test coverage for windowed history paging and does not change product behavior. No concrete merge-blocking risk was found.

      Pre-merge checks: Passed 4

      Check nameStatusExplanation
      Title checkPassedThe title names the change: a test in the server package that checks windowed history pages against the full index at the window edges. The raw summary describes a window-equivalence test that compare…
      Description checkPassedThe description follows the template's main sections in substance. It states the problem (an independent review found planted bugs that the existing tests missed). It explains the change (a generated …
      Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
      Full details: Title check

      Explanation

      The title names the change: a test in the server package that checks windowed history pages against the full index at the window edges. The raw summary describes a window-equivalence test that compares window pages with the full index, and the objectives say the same. The title is specific and matches the changeset. It is a test-only change, and the title says so with the test prefix. The title is a little long at 91 characters, but it is still clear.

      Full details: Description check

      Explanation

      The description follows the template's main sections in substance. It states the problem (an independent review found planted bugs that the existing tests missed). It explains the change (a generated test now compares window pages with the full-index page, plus new threads for specific cases). It states that no product code changes. It gives verification detail: a table of planted bugs, the seed check, the number of bugs caught, and the runtime change. The Scope section does not link a bug issue. It cites a PR (#34573) and a review, and it does not say why a test-only addition needs no issue or whether a maintainer asked for it. The template also asks for the model and harness used. The description says 'Created with Claude Fable 5.2 in Claude Code', so that part is present. The Problem section does not state a user-facing bug, because this PR adds tests for planted bugs, so the framing is less direct than the template expects. Overall the description is mostly complete.

      Resolution

      Optional improvements: add a short Scope note that explains why no issue is linked (test-only change for planted bugs) or link the review issue. State the Problem as the coverage gap in plain terms, so it does not depend on the external PR for context.

      Finishing Touches

      Generate unit tests (beta)

      • Commit to this branch
      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
      Recent review info

      Run configuration

      Commits

      Reviewing files that changed from the base of the PR and between 75c243783f8f21fec6b8c765ec6dd92fed231bf5 and 77de3cb309b1d197c56d160d22ce8d37ba9302ab.

      Files selected for processing: 1

      • apps/server/src/orchestration-v2/ProjectionStore.test.ts

      Included review availability: This review used your included allowance. 8 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 10 reviews per hour.

    5. t3dotgg(GitHub profile, opens in a new tab) merged thisf539020

Sign in to join this conversation.