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
Follow-up fix fails with "a branch named … already exists" when creating the worktree #3687
On #3644 a follow-up fix failed four times in a row at worktree creation with git's "a branch named … already exists" (#3680 item 7). A leftover local branch from an earlier run of the same PR blocks every later run until someone cleans up by hand.
Expected / acceptance criteria
Creating the worktree for a follow-up on an existing PR branch succeeds when a local branch of that name already exists: the worker reuses it after resetting it to the fetched remote head, or removes the stale branch/worktree registration first (including git worktree prune for a registration whose directory is gone).
Work is never discarded silently: if the stale local branch has commits that are not on the remote PR branch, the run fails with a clear message naming the branch instead of deleting them.
Tests with a real temporary git repository for: stale branch equal to remote, stale branch behind remote, stale branch with unpushed commits, stale worktree registration.
Implementation
Look at the worktree creation path used for PR follow-ups in packages/core/src/git/ (worktree manager). Replace the unconditional git worktree add -b with a path that handles an existing branch as described. Run git-backed tests without SSH_ASKPASS.
Activity
propr-dev commentedon Nov 18, 2026
🤖 AI processing has started for this issue using claude agent with claude-opus-5-5 model.
I'll analyze the problem and work on a solution. This may take a few minutes.
Processing Details:
claudeclaude-opus-5-53687/claude-opus-5-5-follow-up-fix-fails-with--20261118-1159-u203686-epic-0-9-g6iissue-3687-20261118-1159-claude-opus-5-5-u20🔍 Track Task Execution