feat(HAI-054): implement pool recycling in aiMergeTask cleanup step

- Release worktree back to pool when recycleWorktrees setting is enabled
- Skip worktree removal when released to pool, preserving it for reuse
- Fall through to force-remove behavior when pool is unavailable or recycling is disabled
This commit is contained in:
Dustin Byrne
2026-03-25 23:39:27 -04:00
parent 1dfd70757a
commit 95ec4bc4a1

View File

@@ -241,6 +241,9 @@ export async function aiMergeTask(
if (otherUser) {
console.log(`[merger] Worktree retained — still needed by ${otherUser}`);
result.worktreeRemoved = false;
} else if (options.pool && (await store.getSettings()).recycleWorktrees) {
options.pool.release(worktreePath);
result.worktreeRemoved = false;
} else {
try {
execSync(`git worktree remove "${worktreePath}" --force`, {