Skip to content

Preserve changing timeline history - #4397

Merged
ymichael merged 2 commits into
get-bb:mainfrom
hemaaanth:fix/timeline-omitted-row-rebuild-loop
Oct 1, 2026
Merged

ymichael merged 2 commits into
get-bb:mainfrom
hemaaanth:fix/timeline-omitted-row-rebuild-loop

Conversation

@hemaaanth

@hemaaanth hemaaanth commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Human comments

What was wrong

Background subagents keep changing rows whose originating turn is outside the latest timeline page. The server reported that omitted history as stale, causing the client to discard loaded history and fetch it again on subsequent child events. Latest-window projection also missed delegation progress/completion state. See #4388.

What changed

Send bounded changed-row suffixes in optional timelinePage.olderRowUpdates and merge them into already-loaded rows, including repeated refreshes of the same snapshot. Updates share the page byte allowance; oversized updates retain the conservative rebuild signal. Status-only requests omit rows and updates. Retrieve latest background/delegation state and apply output limits consistently. Extend the existing regressions and timeline pagination documentation.

The HTTP response field is optional; CLI/SDK consumers inherit it without new request flags. No host-daemon wire changes, protocol bump, migrations, persisted data rewrites or agent lifecycle changes.

How you verified

Final head: 79 affected server tests; all 282 client-core tests and typecheck; server typecheck, formatting and diff checks; final CI green, including an explicitly passing bundle-budget check. Shared-budget and same-snapshot regressions fail before their fixes and pass afterward. Supplementary real-database/API/client tests exercise both steer and new-turn with synthetic background events.

Independent matched base/PR source apps with fresh stores and real Claude native background agents reproduced loaded-history replacement and scroll movement in the control during steers and genuine new turns. For the new-turn run, a native subagent launched four native background commands (150/210/270/330 seconds), yielded, and resumed to report their completions. Twenty-two explicit start requests per build were accepted before any of those commands finished. After loading the older delegation, the control lost its launch context and shifted from 2740px to 2460px; the PR retained it at 6741px through all four updates and repeated full/delta refreshes. Expanding the real PR delegation retained all 9 canonical children and completed status. Screenshots, exact commits, raw request/event evidence and build provenance are in the review thread's HANDOFF.md.

Normal successful new turns while a visible local Agent remains continuously nonterminal are prevented by existing product policy on both builds: explicit start returns 409/already_active, auto steers, and queue waits. The verified new-turn path uses continuing nested commands and real child resumption. No lifecycle policy or events were altered to bypass that gate. No transient loading-indicator frame was captured.

Fixes #4388

AGENT GENERATED

A latest timeline page reports olderRowsSourceSeqEnd for rows it omits.
When a row on an older page keeps receiving events (a running background
subagent under a later message), that value passes the client's loaded
tip on every event. The client then drops its loaded history, reloads
the older pages, and repeats, so the transcript flickers.

The latest page now sends omitted rows that reach its window start as
timelinePage.olderRowUpdates, cut to the children that reach it. The
client joins them into its loaded rows by id, and those rows no longer
count toward olderRowsSourceSeqEnd. The latest build also backfills
delegation progress and completion state, so a pulled-in delegation
keeps its status and output.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael ymichael changed the title Keep loaded history while omitted timeline rows keep changing Preserve changing timeline history Sep 30, 2026
@ymichael
ymichael merged commit 3fad311 into get-bb:main Oct 1, 2026
20 checks passed
ymichael added a commit that referenced this pull request Oct 8, 2026
## Human comments

## What was wrong

Background updates made long timelines repeatedly discard and reload
their loaded history. #4397 sends updates for older rows, but when
pagination cuts within a large turn, the content paginator also includes
those fully omitted rows in its stale-history sequence. Even when their
updates fit in the response, that duplicate accounting tells the client
to rebuild. The affected live thread repeatedly dropped from 16 rendered
rows to 7 before reloading.

## What changed

Only partially returned rows contribute omitted-child sequences from
content pagination. Fully omitted rows are accounted for by the outer
paginator, which excludes updates already included in the response.
Missing nested changes and updates exceeding the response budget still
require a rebuild. No public or daemon wire fields change.

## How you verified

- Regression assertions failed before the fix and pass afterward.
Coverage includes fully omitted rows, partially returned nested rows,
and updates exceeding the byte budget.
- 47 tests passed through `pnpm exec turbo run test --filter=@bb/server
-- test/services/threads/timeline-pagination.test.ts
test/services/threads/timeline-parented-pagination.test.ts
test/services/threads/timeline-event-budget.test.ts`.
- Server typecheck, formatting, and `git diff --check` passed.
- In an isolated source app with over 1,600 synthetic command events,
loaded history stayed mounted after a late update: all 25 rendered rows
remained, and the visible anchor stayed at y=64 across the refresh.
- Built and launched `pnpm start:worktree`; verified the prepared
timeline renders in its production bundle.

> AGENT GENERATED

Co-authored-by: qa <qa@x>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Transcript flickers between full history and "Loading older messages…" while background subagents stream

2 participants