Skip to content

Agent Host: Avoid worktree creation failure when target directory exists #325527

Description

@roblourens

When a new Agent Host session uses worktree isolation, its prompt-derived worktree directory can already exist even when the corresponding Git branch does not. In that case, git worktree add fails with an error like:

fatal: '/Users/tyleonha/Code/Microsoft/vscode.worktrees/greeting-response' already exists

Worktree naming should treat both existing branches and existing target paths as collisions, choose another available name, and avoid races between concurrent session creation in the same repository.

(Written by Copilot)

Metadata

Metadata

Assignees

Labels

agent-hostIssues for the agent-host implementation (not the protocol)bugIssue identified by VS Code Team member as probable buginsiders-releasedPatch has been released in VS Code InsidersverifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions