Delete managed worktree branches on cleanup - #2726
Open
plx wants to merge 1 commit into
Open
Conversation
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human comments
Like #2725, this was discovered by Fable while I had it onboarding me to the codebase and assessing the route to some adjustments/plugins I was curious about making for myself.
Since this bug also seemed to check out, I had Codex verify and then open this PR, too.
What was wrong
removeWorktreeremoved managed checkout metadata and the directory but never deleted the branch created bygit worktree add -B. Successful cleanup therefore left every generatedbb/<slug>-<threadId>branch in the source repository, contrary to the worktree guide's cleanup contract reported in #2724.What changed
git worktree remove, delete that branch against the resolved common Git directory while also coordinating through the shared Git-ref mutation lock.The server↔daemon command and result schemas did not change, so
HOST_DAEMON_PROTOCOL_VERSIONis unchanged.How you verified
TMPDIR=/private/tmp pnpm exec turbo run test --filter=@bb/host-workspace --force --env-mode=loose— 9 files, 233 tests passed. Loose env mode forwards the normalized macOS temp path around the existing/tmpvs/private/tmpassertion onmain.pnpm exec turbo run typecheck --filter=@bb/host-workspace --force— passed.pnpm exec turbo run test --filter=@bb/server --force -- --run test/environments/environment-provisioning.test.ts— 11 tests passed, including preservation of the stored branch name during managed reprovision.origin/main: after managed environment destruction, the worktree disappeared butgit branch --liststill returnedbb/branch-cleanup-repro-thr_wzberxex69.bb/branch-cleanup-fixed-thr_x4z2wru6gzwere gone.pnpm exec oxfmt --check docs/worktrees.md packages/host-workspace/src/provisioning.ts packages/host-workspace/test/provisioning.test.tsgit diff origin/main...HEAD --checkFixes #2724