feat(FN-5058): merge fusion/fn-5058

This commit is contained in:
gsxdsm
2026-05-18 11:01:32 -07:00
parent bb48665dc7
commit 46d09285d5
10 changed files with 329 additions and 0 deletions

View File

@@ -50,6 +50,7 @@ import {
createTaskLogTool,
} from "./agent-tools.js";
import { RemovalReason, removeWorktree } from "./worktree-backend.js";
import { pruneWorktreeAdminEntries } from "./worktree-prune.js";
import { activeSessionRegistry } from "./active-session-registry.js";
const stepExecLog = createLogger("step-session-executor");
@@ -1343,6 +1344,12 @@ Follow instructions precisely and avoid unrelated changes.`,
// best-effort cleanup; log but don't mask the original error
stepExecLog.log(`Warning: failed to remove partial worktree directory after creation failure: ${worktreePath}`);
}
await pruneWorktreeAdminEntries({
rootDir,
reason: "step-session-create-failed",
target: worktreePath,
logger: stepExecLog,
}).catch(() => undefined);
throw err;
}
@@ -1357,6 +1364,12 @@ Follow instructions precisely and avoid unrelated changes.`,
} catch {
stepExecLog.log(`Warning: failed to remove worktree after identity-guard install failure: ${worktreePath}`);
}
await pruneWorktreeAdminEntries({
rootDir,
reason: "step-session-guard-failed",
target: worktreePath,
logger: stepExecLog,
}).catch(() => undefined);
throw err;
}