fix(agent-manager): preserve named worktrees on collision - #11001
Conversation
Code Review SummaryStatus: 1 Issue Found | Recommendation: Merge (advisory only) Overview
Issue Details (click to expand)SUGGESTION
Previously Flagged Issues — Now Resolved
Other Observations (not in diff)
Retry path double-collision: If two concurrent processes both pass Latest commit (style): The newest commit ( Files Reviewed (6 files)
Fix these issues in Kilo Cloud Reviewed by claude-4.6-sonnet-20260217 · 165,776 tokens Review guidance: REVIEW.md from base branch |
…1001) * fix(agent-manager): preserve named worktrees on collision * fix(agent-manager): keep collision fallback deterministic * style(agent-manager): format branch resolver
Calling
agent_managermore than once with the same explicitbranchNamecould remove the first live worktree, leave its branch behind, and then create a timestamp-suffixed replacement. This broke the first agent while making the second agent's branch unpredictable. The same collision could occur through the Advanced Worktree modal, where repeated names are valid requests for separate agents.Resolve branch availability before creating or removing anything. The requested name remains the first branch, subsequent independent requests receive deterministic numeric suffixes such as
echo-hello-world-2, and existing worktrees remain untouched. Exact replay of one Agent Manager event is deduplicated byrequestID, while distinct tool calls continue to create distinct worktree-backed sessions even when they share a branch-name seed.Closes #10976