Skip to content

Forked threads have an empty timeline — fork should clone source events #1500

Closed

Description

@swairshah

Forked threads come up with an empty timeline. The provider session gets cloned fine — the model has the whole conversation — but none of the source thread's events come along, so the UI shows a blank thread.

bb thread fork <pi-thread-id> --workspace reuse
bb thread fork <pi-thread-id> --source-seq-end 30

Both settle idle with /timeline returning no rows, while ~/.bb/pi-bridge-sessions/<fork>.jsonl contains the full cloned conversation.

Context: I'm building a plugin that does pi's esc-esc rewind inside bb. Pick any step of a pi session, fork at that point, keep typing. The session side already works (I truncate the fork's session file before its first turn, and the model continues from exactly that step). The part I can't do is show the inherited history in the forked thread. Right now I render the session file myself in a plugin panel, which works but isn't the real thread page.

A couple of things I found while poking at this:

  • The pi bridge's thread/fork already takes a providerCheckpointId and calls pi's SessionManager.createBranchedSession, so branch-at-any-entry exists at the provider level. The public fork API only takes sourceSeqEnd and doesn't seem to map it down to a checkpoint.
  • I tried inserting synthetic rows into the events table directly (client/turn/requested, turn/started, item/completed, turn/completed). sqlite takes them and the shapes are easy to produce, but the server serves events from its in-memory cache, so they don't appear until a restart. So rendering foreign events isn't the hard part — there's just no write path.
  • Import an existing ACP provider session as a thread (session/load with history persist) #1028 is the same underlying ask from the import side (adopt an existing session with history).

What I'd like, either one:

  1. fork copies the source thread's events up to sourceSeqEnd (ideally also accepting a provider checkpoint as the anchor), or
  2. some SDK way to project session history into the timeline — events.append, or an "adopt session" endpoint. That would cover Import an existing ACP provider session as a thread (session/load with history persist) #1028 too.

Happy to share the plugin that exercises all of this.

Activity

  1. changed the title [-]Fork should clone the source thread's timeline events (and/or expose an event-append path for provider-session history)[/-] [+]Forked threads have an empty timeline — fork should clone source events[/+] on Aug 13, 2026
  2. added theissue type on Aug 13, 2026
  3. added
    threads
    on Aug 18, 2026
  4. SawyerHood commented on Aug 18, 2026

    @SawyerHood
    Collaborator

    Reproduction & root-cause report: https://get-bb.github.io/reports/issues/1500.html

    • Verdict: REPRODUCED · root-cause confidence: high
    • Root cause (short): The fork path (thread-fork.ts → thread-create.ts resolveForkDescriptor → thread.start{fork:{sourceProviderThreadId}}) only clones the provider session and never copies/projects source events into the fork, so the timeline projection has nothing to render; additionally sourceSeqEnd is never mapped to the recorded turn/completed providerCheckpointId, so pi/claude-code/codex forks always clone the session tip regardless of the requested anchor.
    • Proposed fix: (A) Honor sourceSeqEnd at the provider: in thread-create.ts resolveForkDescriptor, resolve the root turn containing/preceding sourceSeqEnd and read its turn/completed.providerCheckpointId (reuse thread-edit-message.ts logic incl. codex turn-id case); add optional sourceProviderCheckpointId to threadStartCommandSchema.fork in host-daemon-contract (bump HOST_DAEMON_PROTOCOL_VERSION); pass it through runtime.ts thread/fork (adapter already forwards it and rejects for tip-only providers); 400 for tip-only providers or missing checkpoint instead of silently forking the tip. (B) Make inherited histo…
    • Caveats: Priority/Effort project fields could not be read (token lacks read:project). Symptom 1 (empty timeline) is a long-standing design gap rather than a regression — docs/provider-bridge-protocol.md acknowledges it. The reporter's claim that directly inserted event rows are invisible until restart was refuted at the HTTP /timeline and CLI layer (timeline cache keys on maxSeq read from SQLite); the brow…

    The report has copy-paste repro steps, screenshots where the bug is visual, code permalinks at 16ceb3a54, and repro artifacts. It was independently re-run by a second agent (see its Verification section).

    AGENT GENERATED: by Claude Opus 5

  5. added
    confirmed-repro
    on Aug 18, 2026
  6. swairshah commented on Aug 20, 2026

    @swairshah
    ContributorAuthor

    I have a prototype implementation for this issue in :
    swairshah@afcf116

    It copies the source thread's visible conversation events into the fork before provisioning. It honors sourceSeqEnd for the copied history, skips identity, provisioning, delta, and usage events, and excludes side-chat forks. It uses the normal event ingestion path so timeline rendering, search indexing, and realtime notifications continue to work.

    The prototype does not fix the other problem found in the reproduction report. sourceSeqEnd is still not translated into sourceProviderCheckpointId, so the visible history can stop at the selected turn while the provider session still forks from the tip.

    Before I open an upstream PR, are you open to the eager-copy approach for inherited timeline history? If so, I can do to PRs: checkpoint propagation first, followed by the timeline copy. If you would rather persist sourceSeqEnd and project the source history lazily I can rework the prototype.

  7. added 2 commits that reference this issue on Aug 21, 2026
    32ef073
    6ce6972
  8. self-assigned this
    on Aug 21, 2026
  9. added 3 commits that reference this issue on Aug 21, 2026
    e522476
    d811c20
    d7d96f4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

confirmed-reprothreads

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions