Conversation
ymichael
force-pushed
the
bb/timeline-structural-selection
branch
from
September 17, 2026 23:25
ea132d8 to
6588971
Compare
ymichael
marked this pull request as ready for review
September 18, 2026 01:25
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
Collapsed timelines read and decode command-output bodies and parse shell commands even when the commands are hidden inside a summary. Summary expansion also used a separate partial-context path, so some valid summaries failed expansion or included rows from adjacent groups. Simply sharing the page loader made small expansions reconstruct unrelated work and introduced large regressions.
What changed
Omit hidden command-output bodies when building inactive collapsed pages, hydrate visible calls by event primary key before byte pagination, and parse command intents only for rendered command rows. Active, flat, nested, and unlimited-output requests retain full payload loading.
Use one context loader and row planner for pages and expansion. Expansion discovers item IDs belonging to the requested turn or parented children in the interval, follows their histories across turns, and retains assistant boundaries and shared control state. Other overlapping turns no longer pull in unrelated item histories. Preserve late completions, including child completions missing their parent-call field, and the endpoint's existing row-range expansion behavior.
Exclude already-loaded events from subsequent turn/child queries. Return primitive stored-event columns directly from SQLite to avoid a second row-mapping pass. Expansion skips unused whole-thread page-ordering work, resolves only referenced request IDs, and reuses the existing bounded decode cache. Remove the old partial-turn filtering/backfill path. No migration, public API, or host protocol change.
Rebased onto main after #3874 and #3876. Final before/after measurements compare main
0bb64f3789with head63fb6187d4, using the frozen main database and actual server routes.Default measurements cover all 2,385 threads (three measured rounds after warmup). Expansion covers all 6,183 latest-page summaries and follows every cursor; all candidate expansions succeed, including two that return 500 on main. Open-then-expand covers one top-level summary in each of 2,012 applicable threads. Broad expansion sweeps use one measured round after warmup; focused repeated checks are described below. All default response hashes match, with the same deleted-thread 404 in both versions.
Cold means application caches cleared; SQLite/OS caches are not flushed. Server-route timings include response-body consumption and exclude network/browser rendering. The standalone and open-then-expand populations differ, so their absolute medians are not a cache-effect comparison. Cold expansion is not universally faster: its corpus median increases by 0.19 ms. The old roughly 58 ms regression is eliminated, but some small cold expansions retain overhead.
Repeated 198 previously problematic cases for 15 measured rounds each, alternating version order. No repeated case crosses the preset regression threshold (>10% and >5 ms), but smaller regressions are real: the largest cold increase is 1.39 → 5.70 ms. The original identical-response problem case now measures 6.60 → 9.13 ms cold (previous draft ~58 ms), 5.88 → 6.87 ms repeat, and 6.45 → 7.50 ms after default open. Repeated the 24 cases with >2 ms standalone overhead after default open too; the largest remaining increase is 1.37 → 5.24 ms. These costs remain visible in the normal request path; the PR is an overall improvement with small expansion tradeoffs, not a universal speedup.
How you verified