Repository navigation
Description
Workflow
In a project backed by a local unmanaged Git checkout:
- Finish and archive every thread attached to the project workspace.
- Create a new thread in that project.
- Select New branch from: main so bb checks out a branch in the existing workspace.
What happened
Thread creation failed with:
Cannot checkout branch while another thread is using this workspace
The project had no unarchived threads, including hidden threads. The remaining threads were archived and idle.
Archiving the threads did not release the workspace claim. bb thread stop did not help because stopping an idle thread is intentionally a no-op: the archived threads remained in idle status and continued to satisfy the checkout guard.
Using an isolated worktree or creating the thread without a requested branch checkout avoids the failure. Deleting the archived threads would also avoid it, but that should not be required and destroys history.
Expected behavior
After every thread attached to a workspace is archived, bb should allow a new thread to check out a branch in that workspace.
An unarchived thread that is actually starting, idle, or active should continue to block a branch checkout that would rewrite its working tree.
Likely mechanism
unmanagedAttachRefusal() calls hasLiveThreadAtHostPath() when a thread request includes a branch checkout.
hasLiveThreadAtHostPath() joins threads to environments and filters for:
- the same host and physical path;
- a non-deleted thread;
starting,idle, oractivestatus.
It does not filter out rows with archivedAt set. Archiving an idle thread preserves its idle status, so an archived thread is treated as a live workspace user indefinitely.
There is already a liveThreads() query helper that adds archivedAt IS NULL, but this query currently uses nonDeletedThreads() instead.
The existing unmanagedAttachRefusal test covers an active thread blocking checkout, but not an archived idle thread releasing the claim.
The cross-project physical-path guard was introduced in #1049. This report does not challenge that safety guard; it concerns archived threads being included in its definition of a live workspace user.
Suggested fix
- Exclude archived rows in
hasLiveThreadAtHostPath()while retaining the nonterminal-status filter. - Add regression coverage proving:
- an archived idle thread at the path does not produce a
live-threadrefusal; - an unarchived active thread at the path still does.
- an archived idle thread at the path does not produce a
Environment
- bb-app 0.38.0
- Linux x64
- Node.js 26.7.0
- Local unmanaged Git workspace
A deterministic reproduction script using bb's in-memory server test harness will follow separately.
AGENT GENERATED: by GPT-5.6 Sol
Activity
hemaaanth commentedon Aug 20, 2026
Here is a deterministic reproducer that uses bb's in-memory server test harness and the real workspace-claim query. It does not touch a running bb service, an existing database, or a real workspace.
With workspace dependencies installed, save it as
apps/server/scripts/repro-archived-thread-blocks-checkout.mtsand run:Current output:
SawyerHood commentedon Aug 21, 2026
Reproduction & root-cause report: https://get-bb.github.io/reports/issues/2068.html
The report has copy-paste repro steps, screenshots where the bug is visual, code permalinks at the base commit, and repro artifacts. It was independently re-run by a second agent (see its Verification section).
Allow branch checkout after workspace threads are archived (get-bb#2069)
Report live threads when an archived thread still holds its environme…