fix(FN-4948): harden guard install failure cleanup paths

Fusion-Task-Id: FN-4948
Fusion-Task-Lineage: dc622643-4c3e-4217-9219-a6a6e5424427
This commit is contained in:
Fusion (runfusion.ai)
2026-05-17 13:31:54 -07:00
committed by gsxdsm
parent 837f07e6ca
commit eff52748bc

View File

@@ -8498,6 +8498,19 @@ Backward compat fallback: if JSON is unavailable, you may still begin output wit
}
};
const installGuardOrCleanup = async () => {
try {
await installTaskWorktreeIdentityGuard({ worktreePath: path, taskId });
} catch (error) {
try {
await execAsync(`rm -rf "${path}"`, { cwd: this.rootDir });
} catch {
executorLog.log(`Warning: failed to remove worktree after identity-guard install failure: ${path}`);
}
throw error;
}
};
let staleLockRecoveryAttempted = false;
try {
await createWithBranch(branch);