Repository navigation
Stop re-projecting whole turns on turn-details pages and whole epochs on outline loads - #7243
Merged
ymichael merged 2 commits intoNov 9, 2026
Conversation
ymichael
marked this pull request as ready for review
November 9, 2026 18:06
Every "load earlier" page of turn summary details re-read, decoded and re-projected the whole turn, then paginated it, and re-expanding a turn paid the same again. Cache the scoped projection per thread and request shape, keyed on the cursor snapshot and the thread's rewrite generation, and serve every page and repeat expand by paginating the cached rows with their cached leaf sizes. Entries expire when a retained-output preview they contain would flip to retention-expired. Snapshot A/B (3 alternating pairs, load avg 12-69), whole walk / re-expand: - 6e9knccemi t2 (7.6k events, 13 pages): 1913 -> 155 ms / 1914 -> 4.2 ms - u738kqjs29 t3 (7.4k events, 4 pages): 859 -> 221 ms / 886 -> 0.7 ms - avim9t7kpe t1 (5.9k events, 6 pages): 824 -> 140 ms / 840 -> 1.2 ms First pages and single-page turns cost the same as before. Pages are byte-identical across 23 turns on 12 threads. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Any backgroundTask or delegation item in the projected history stopped the outline from ever keeping a checkpoint, so every outline load of a thread that had run one background command reprojected its whole epoch. Treat background items like tool calls instead: their ids join the checkpoint's referenced items, and a later event for one of them rebuilds from scratch. The outline selection already drops a task's normal completion, so the full build never depended on it. Outline replay over 107 snapshot threads (4,573 append steps, incremental vs the full builder at every step): 0 mismatches. Active outline reload, 3 alternating A/B pairs: d5ej4e2gtv 286 -> 116 ms, 6e9knccemi 34 -> 1.4 ms, kdrbtee92b 12.6 -> 2.6 ms, ymhw6pktq4 12.1 -> 1.0 ms; replay median per append: yvsvx8anai 18.4 -> 2.1 ms, dwzy4aij2h 16.5 -> 2.3 ms. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
force-pushed
the
bb/timeline-s7-other-turn-thread-sized-paths-thr_mb7ipbhx2t
branch
from
November 9, 2026 20:03
3d2811c to
bdd08bf
Compare
ymichael
deleted the
bb/timeline-s7-other-turn-thread-sized-paths-thr_mb7ipbhx2t
branch
November 9, 2026 20:10
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.
Human comments
What was wrong
Two read paths re-projected whole turns or whole histories on every request (REPORT #7 of the Nov 7 timeline audit):
buildTimelineTurnSummaryDetailsread, decoded and projected the entire turn, then paginated it. Every "load earlier" page and every re-expand paid the full projection again. 6e9knccemi turn t2 (7,563 events) took 13 pages × ~150 ms.conversation-outline-cache.tsrefused to keep a checkpoint once anybackgroundTaskordelegationitem appeared in the projected history (hasBackgroundState). Every outline load of a thread that had ever run a background command therefore reprojected its whole epoch. 11 of the 12 audit threads have such items; d5ej4e2gtv paid ~140–290 ms per load.What changed
timeline-turn-details-cache.ts(new) keeps the scoped turn-details projection in a per-connection LRU (32 entries, 32 MiB, 8 MiB per entry).retention-expired, since that preview depends onDate.now().paginateTimelineContentsaccepts precomputed leaf sizes (measureTimelineContentLeafBytes) so they are measured once.conversation-outline-cache.tsdrops the blanket background guard. Background and delegation item ids join the checkpoint's referenced item set, exactly like tool-call ids, so a later selected event for a retained item rebuilds from scratch.completedcompletion and never selects delegation rows, so the full build never depended on those events.docs/timeline-pagination.mddocuments both behaviours.No wire, CLI or SDK changes.
How you verified
Benchmarks used the shared audit harness, in-process against an APFS clone of the Nov 7 production snapshot. Runs were 3 alternating base/fix pairs on the same machine, each the median of 3 samples. Load average was 12–69 because other slices were benchmarking at the same time, so absolute numbers are noisy; the pairs alternate.
Turn summary details (app parameters:
deferContent, whole turn, walk everybeforeCursorpage):First pages and single-page turns cost the same as before. Parity: every page of 23 turns on 12 threads hashes identically between base and fix.
Conversation outline, thread forced active, second load after the first:
Outline parity replay:
eventsand re-appends it step by step: at turn ends, mid-turn, and at random background-task events.loadThreadConversationOutline(incremental) withbuildThreadConversationOutline(independent full builder).Tests added:
timeline-turn-details-cache.test.tsretention-expiredonce its retention passes. Fails if the expiry is ignored.conversation-outline-incremental.test.tscompleted,failedor progress.Commands:
Not changed:
GET /threads/:id/messages/:seq, empty-latest-window retries,bb thread waitpolling, github-pr-statusturnRanGh, fork history copy.Refs #4674
🤖 Generated with Claude Code