We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 63e872d commit 7182176Copy full SHA for 7182176
packages/agent/src/worktree-manager.ts
@@ -178,7 +178,12 @@ export class WorktreeManager {
178
let attempts = 0;
179
const maxAttempts = 100;
180
181
- while ((await this.worktreeExists(name)) && attempts < maxAttempts) {
+ // Check both worktree directory AND branch existence to avoid collisions
182
+ while (
183
+ ((await this.worktreeExists(name)) ||
184
+ (await this.gitManager.branchExists(name))) &&
185
+ attempts < maxAttempts
186
+ ) {
187
name = this.generateWorktreeName();
188
attempts++;
189
}
0 commit comments