Repository navigation
Order the timeline by source sequence and drop the ordering boundary - #7795
Merged
Merged
Conversation
The timeline grouped rows turn by turn until the first user message that landed inside another turn, then sorted everything after it by sequence. Pagination, the grouping context and the outline checkpoint all had to reproduce that mode switch. Every row is now ordered by where its content starts. A completed turn's work collapses into one summary row per run, and a run ends at any visible user message inside the turn before its final reply. A summary row starts at its first summarized item, and pending and rejected steers sort like every other row. Because display order equals sequence order, a page owns the rows whose sourceSeqStart is in its window and computes split points from the rows it loads. Removed: the ordering boundary, timeline display ownership, the whole-thread external-user boundary scan, the parented boundary query, the server-side re-sort, and the outline checkpoint's boundary cap. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A steer waiting for the running turn is live state, like activeThinking. The latest timeline page returns it in pendingSteers; it is no longer a row on any page, so rows stay in sequence order and paging needs no exception. The app and `bb thread log` show pending steers after the rows, as before. Once the turn accepts a steer, it becomes a row with the same id where it was accepted. Rejected steers stay rows ordered by their request. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 18, 2026
Closed
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
The timeline had two display orders. It grouped rows turn by turn until the first user message that landed inside another turn (a message while a turn was still open, or while a delegated child was still running). After that "ordering boundary" it sorted every later row by source sequence. #320 added the switch so a message sent mid-turn shows where it was sent. Everything downstream then had to reproduce it:
timeline-display-ownership.tsto work out which page shows a row whose display position differs from its sequence.The display order itself was also inconsistent before the boundary: operation notices recorded mid-turn showed after the turn's reply, and two turns running at once showed one turn whole before the other. Pending steers were pinned to the bottom on threads without a boundary but sorted into place on threads with one.
What changed
One display rule (
packages/thread-view):Deleted:
timeline-display-ownership.ts;timeline-context-order.ts(the grouping context keeps only request/turn bookkeeping);getFirstParentedTimelineBoundarySequenceand the late-delegation rows it needed;listStoredStandaloneThreadTimelineRows, which only display ownership called;orderTimelineRowsUsingContext;Because display order is now sequence order, a page owns exactly the rows whose
sourceSeqStartis in its window.Pending steers become live state (
server-contract, server, app, CLI):pendingSteersfield, alongsideactiveThinkingandactiveWorkflows, so push deltas and window reuse carry it.bb thread logshow pending steers after the rows, as main does.Other:
hasTimelineGroupingContextChangesInRangereplaces the old change probe, with a query-plan test and query-cost case.docs/timeline-pagination.mddescribes the new rule.pendingSteers, a required array that is empty off the latest page. SDK types pick it up from the contract.Visible changes, all toward "in the order it happened":
How you verified
Real data, from a
VACUUM INTOcopy of a 10.7 GB local bb database:Full builds, main vs this branch, all 4,995 threads. 4,615 are identical. Every difference is one of the moves in the table above. I checked each pattern by hand on the threads where it showed up.
Paged walks.
test/timeline-history/paged-walk.test.tswalks a thread page by page at the default and a 120-event budget and compares the result with one full build. It passes for 1,000 walks: every thread whose display changed (380) plus 120 random ones. Main passes the same set. The deletion was safe because display order now equals page order. Two intermediate designs broke the walks for exactly that reason (an in-turn reorder, and pending steers appended after sorting), and both were fixed by removing the special order, not by adding ownership.Outline replay with no boundary cap.
test/timeline-history/outline-replay.test.ts(opt-in,BB_TIMELINE_HISTORY_DB, same harness as #7765) replays the 5 largest threads plus 7 overlap-heavy ones. It appends events in random chunks, changes status at random, runs live pruning and switches connections, and the incremental outline matches a full build at every step (197 s).Live. On a
pnpm start:worktreeinstance:origin/maininstance.sleep 25and steered it mid-command. The steer was accepted one event later and renders as a row there, splitting the turn's summary around it.pendingSteerswas empty afterwards.Tests:
pendingSteers, and acceptance turns it into a row with the same id.Commands:
pnpm exec turbo run typecheck lint --filter='...[origin/main]'passed (140 tasks).pnpm exec turbo run test --filter=@bb/server --filter=@bb/db --filter=@bb/thread-view --filter=@bb/server-contract --filter=@bb/client-core --filter=@bb/cli --filter=@bb/apppassed: server 4,316, db 718, thread-view 553, server-contract 88, client-core 239, cli 934, app 7,128. One server test timed out while all suites ran concurrently and passes alone in 7.5 s.pnpm exec turbo run check:query-costs --filter=@bb/dbpassed.🤖 Generated with Claude Code