fix(FN-4917): correct pooled invalid worktree cleanup call
Fusion-Task-Id: FN-4917 Fusion-Task-Lineage: 1422a545-f4b5-4e1f-a347-8be2a4202f45
This commit is contained in:
committed by
gsxdsm
parent
2bc76cf00f
commit
1cb952fe58
@@ -11,6 +11,8 @@ import {
|
|||||||
type WorktreePool,
|
type WorktreePool,
|
||||||
classifyTaskWorktree,
|
classifyTaskWorktree,
|
||||||
isInsideWorktreesDir,
|
isInsideWorktreesDir,
|
||||||
|
removeWorktree,
|
||||||
|
RemovalReason,
|
||||||
} from "./worktree-pool.js";
|
} from "./worktree-pool.js";
|
||||||
import {
|
import {
|
||||||
NativeWorktreeBackend,
|
NativeWorktreeBackend,
|
||||||
@@ -286,7 +288,14 @@ export async function acquireTaskWorktree(opts: AcquireTaskWorktreeOptions): Pro
|
|||||||
await store.logEntry(task.id, `Pool returned ${pooledClassification.classification} worktree (${pooledClassification.reason}); creating fresh worktree`, undefined, runContext);
|
await store.logEntry(task.id, `Pool returned ${pooledClassification.classification} worktree (${pooledClassification.reason}); creating fresh worktree`, undefined, runContext);
|
||||||
if (isInsideWorktreesDir(rootDir, worktreePath, settings)) {
|
if (isInsideWorktreesDir(rootDir, worktreePath, settings)) {
|
||||||
try {
|
try {
|
||||||
await backend.remove(worktreePath, { rootDir, force: true, reason: RemovalReason.PoolCleanup, taskId: task.id });
|
await removeWorktree({
|
||||||
|
rootDir,
|
||||||
|
worktreePath,
|
||||||
|
settings,
|
||||||
|
reason: RemovalReason.PoolPrune,
|
||||||
|
taskId: task.id,
|
||||||
|
audit,
|
||||||
|
});
|
||||||
} catch (removeErr) {
|
} catch (removeErr) {
|
||||||
logger?.warn(`${task.id}: failed to remove unusable pooled worktree ${worktreePath}: ${formatError(removeErr)}`);
|
logger?.warn(`${task.id}: failed to remove unusable pooled worktree ${worktreePath}: ${formatError(removeErr)}`);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user