fix(HAI-092): use generateWorktreeName for fresh worktree directories

- Replace task ID with generateWorktreeName for worktree directory paths
- Worktrees now use human-friendly adjective-noun names (e.g. swift-falcon)
- Add tests for fresh worktree naming, task ID exclusion, and resumed task reuse
This commit is contained in:
Dustin Byrne
2026-03-26 01:16:41 -04:00
parent 2ab34bc11a
commit fc57042522
2 changed files with 76 additions and 1 deletions

View File

@@ -271,7 +271,9 @@ export class TaskExecutor {
// Create or reuse worktree — try pool first when recycling is enabled
const branchName = `hai/${task.id.toLowerCase()}`;
let worktreePath = task.worktree || join(this.rootDir, ".worktrees", task.id);
// Use generateWorktreeName for human-friendly directory names (adjective-noun pattern)
// instead of task.id, so worktrees are named like ".worktrees/swift-falcon"
let worktreePath = task.worktree || join(this.rootDir, ".worktrees", generateWorktreeName(this.rootDir));
let isResume = existsSync(worktreePath);
let acquiredFromPool = false;
const settings = await this.store.getSettings();