Skip to content

Import an existing ACP provider session as a thread (session/load with history persist) #1028

Closed as duplicate

Description

@mgpai22

What I want

Import an existing agent session as a bb thread, with the full history in the timeline and the original session as the live provider session. Nothing summarized, nothing re-ingested, nothing lost.

I run long-lived omp sessions over SSH. Some of them are weeks of accumulated context (a repo-understanding session that later turns treat as memory). I added the project to bb and want those sessions to continue as bb threads. Today the only path is to export the transcript and attach it to a fresh thread's first prompt. That costs a full re-ingest, loses tool calls and turn structure in the timeline, and the result is a copy, not the session.

What already exists

Most of the plumbing is in place on both sides.

bb side:

  • The ACP bridge probes agentCapabilities.loadSession at initialize (packages/agent-runtime/src/acp/bridge/bridge.ts:1525).
  • On resume of a bb-known thread it already calls session/load with the stored providerThreadId, and falls back to session/new with a warning (bridge.ts:1532-1552).
  • During load, every replayed session/update is dropped behind the session.loading gate (bridge.ts:1717). Correct for resume: bb already has that timeline.

Agent side (omp as the working example):

  • omp acp declares loadSession: true (packages/coding-agent/src/modes/acp/acp-agent.ts:520).
  • Its loadSession handler loads the managed session and replays the full history, tool calls with ids and arguments included (acp-agent.ts:563, #replaySessionHistory at acp-agent.ts:2041).
  • The loaded session is the same session file that omp --resume uses. Continuation appends to it. Compaction state and context carry over exactly.

The gap

There is no way to hand bb an external provider session id. session/load is only reachable for sessions that bb created itself. And the one code path that could ingest history discards it by design.

So the feature is narrow:

  1. An import entry point that creates a thread with a caller-supplied providerThreadId, for providers whose agent advertises loadSession.
  2. A persist mode for that first load: translate the replayed session/update stream through the normal event path instead of dropping it, marked as historical so it does not run turn logic.
  3. A workspace check: the imported session has a cwd; bind the thread to a matching project source or environment, and refuse a mismatch.

Proposed shape

bb thread import --project proj_x --provider acp-omp \
  --provider-session 019fb4b0-32f0-7000-b43c-69ac16a18236

Result: a thread whose timeline shows the replayed history and whose next prompt continues the original session. omp --resume on the same id still works from the terminal, because it is the same session.

A capability flag (supportsSessionImport, derived from loadSession at initialize) would let the UI offer this only where it works.

Use cases

  • Migrate a long-lived session into bb when adopting bb on an existing project, instead of starting the context from zero.
  • Mid-task handoff: start work in the agent's own TUI over SSH, then import and continue from bb on another device.
  • Review: import a finished session so its full history is browsable in the bb timeline next to the project's other threads, without paying a re-ingest.

Open questions

  • Agent-specific meta entries in the replay (omp emits things like rule-injection markers) have no bb event type. Rendering them generically, or only under showUnhandledProviderEvents, both seem fine for a first version.
  • Whether import should provision a managed environment or require an existing project source whose path matches the session cwd.
  • Fork of imported threads: out of scope; ACP fork is unsupported today anyway.

Happy to prototype this in a fork once the direction has sign-off.

Activity

  1. SawyerHood commented on Aug 5, 2026

    @SawyerHood
    Collaborator

    This seems great to me! I'm actively working on onboarding and importing threads from other providers was on my list. Would love if you could prototype the import. I can commandeer the PR and do in-depth testing against all of the providers

  2. added
    providers
    provider-acp
    and removed
    enhancement
    on Aug 18, 2026
  3. SawyerHood commented on Sep 9, 2026

    @SawyerHood
    Collaborator

    Tracked as a sub-issue of #3260. The parent now covers the shared scope and links this implementation. This issue retains its distinct evidence and acceptance criteria and remains open until that work is complete.

    AGENT GENERATED

  4. ymichael commented on Oct 8, 2026

    @ymichael
    Collaborator

    Closing as a duplicate of #3260, which tracks adopting existing Codex, Claude Code and ACP sessions as threads.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    onboardingprovider-acpproviders

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions