You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Warn before archiving a thread that has uncommitted work #5952
Archiving a thread removes its worktree a few minutes later. That's expected, but if the worktree still has uncommitted or unpushed changes, the archive dialog doesn't say so, and that work is easy to lose without noticing.
When a thread's worktree has uncommitted or unpushed changes, the archive dialog should say so and offer to:
keep the worktree and archive just the thread, or
have the thread's agent commit and push first, then archive.
Threads with clean worktrees archive as they do today.
Verdict:REPRODUCED, high root-cause confidence. The regression test exercises the actual archive route, retirement sweep, and worktree provider; it fails on two clean origin/main checkouts. The report includes the complete test. All 58 adjacent existing tests pass.
Root cause: Archive schedules retirement without a dirty-worktree guard; cleanup forces Git worktree removal and recursively deletes the directory. Modified tracked files and untracked files disappear. Unpushed commits survive on the local branch in both runs.
No PR: A safe repair requires coordinated archive retention and teardown behavior across subsystems, outside the simple-fix gate.
changed the title [-]Archiving a thread can delete uncommitted worktree changes without warning[/-][+]Warn before archiving a thread that has uncommitted work[/+]on Oct 21, 2026
Following up on #5952 to request maintainer guidance before preparing another implementation.
I reviewed the existing issue and PR #5957, which implemented worktree retention and explicit archive options but was automatically closed after two weeks without being merged. I don't interpret that closure as a technical rejection of the approach.
Questions for maintainers
Is protecting uncommitted, untracked, and unpushed work during thread archival still a desired change?
Should archiving preserve unsafe worktrees by default, or require an explicit choice before cleanup proceeds?
Should the same safety contract apply consistently across the UI, CLI, and SDK, including descendant threads?
The intended outcome is to avoid silently losing local work while preserving predictable cleanup of safe worktrees.
This is an AI-assisted investigation and design question. No new implementation or native test results are being claimed here. The proposal originates from this repository's existing issue; it is not claimed as a VSM-derived finding.
If the direction is approved, we can prepare a focused implementation with source-native regression tests and follow the repository's contributor approval process before opening an upstream PR.
Could the “keep the worktree and archive just the thread” action proposed here also be available through the CLI and SDK, including for clean managed worktrees?
We want automation to archive a conversation when its task ends, while a separate cleanup policy checks for active consumers and verifies that the exact commit is on the remote before removing the checkout. On BB 0.50.1 I confirmed that bb thread archive --help has no option for this workflow. The worktree documentation at the base we tested describes archive-triggered teardown.
A local prototype based on df9619d8e8aac4aff00c0c3ff9b8ef4e2823e4f2 exercises an opt-in bb thread archive <id> --keep-worktrees --json and the equivalent SDK call. It reports the IDs of retained environments, preserves retention during periodic sweeps and repeated archive requests, and leaves ordinary archive and explicit cleanup available. Unarchiving releases that thread's retention. The opt-in refuses a worktree already scheduled for cleanup. A separate route lets an older server reject the request without running ordinary archive. The prototype passed 209 targeted CLI, server, and database tests plus type checking.
Would maintainers be open to this opt-in CLI and SDK behavior as part of #5952?
Activity
bb-slop-cop commentedon Oct 21, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotthreads,workspaces,confirmed-repro.origin/maincheckouts. The report includes the complete test. All 58 adjacent existing tests pass.[-]Archiving a thread can delete uncommitted worktree changes without warning[/-][+]Warn before archiving a thread that has uncommitted work[/+]xLagerFeuer commentedon Nov 16, 2026
Following up on #5952 to request maintainer guidance before preparing another implementation.
I reviewed the existing issue and PR #5957, which implemented worktree retention and explicit archive options but was automatically closed after two weeks without being merged. I don't interpret that closure as a technical rejection of the approach.
Questions for maintainers
The intended outcome is to avoid silently losing local work while preserving predictable cleanup of safe worktrees.
Evidence and current status
da3e60b81d560e114a2bec724bb59c997aaaae7f.This is an AI-assisted investigation and design question. No new implementation or native test results are being claimed here. The proposal originates from this repository's existing issue; it is not claimed as a VSM-derived finding.
If the direction is approved, we can prepare a focused implementation with source-native regression tests and follow the repository's contributor approval process before opening an upstream PR.
appzan commentedon Nov 19, 2026
Could the “keep the worktree and archive just the thread” action proposed here also be available through the CLI and SDK, including for clean managed worktrees?
We want automation to archive a conversation when its task ends, while a separate cleanup policy checks for active consumers and verifies that the exact commit is on the remote before removing the checkout. On BB 0.50.1 I confirmed that
bb thread archive --helphas no option for this workflow. The worktree documentation at the base we tested describes archive-triggered teardown.A local prototype based on
df9619d8e8aac4aff00c0c3ff9b8ef4e2823e4f2exercises an opt-inbb thread archive <id> --keep-worktrees --jsonand the equivalent SDK call. It reports the IDs of retained environments, preserves retention during periodic sweeps and repeated archive requests, and leaves ordinary archive and explicit cleanup available. Unarchiving releases that thread's retention. The opt-in refuses a worktree already scheduled for cleanup. A separate route lets an older server reject the request without running ordinary archive. The prototype passed 209 targeted CLI, server, and database tests plus type checking.Would maintainers be open to this opt-in CLI and SDK behavior as part of #5952?