feat(FN-4753): complete Step 3 — migrate step-session worktree removal

Fusion-Task-Id: FN-4753
Fusion-Task-Lineage: 8229b56a-8997-4faf-8872-18e49b9386ff
This commit is contained in:
Fusion (runfusion.ai)
2026-05-16 10:04:16 -07:00
committed by gsxdsm
parent 2f8719573d
commit 0fc2b9e6b2

View File

@@ -48,6 +48,7 @@ import {
createTaskDocumentWriteTool,
createTaskLogTool,
} from "./agent-tools.js";
import { removeWorktree } from "./worktree-backend.js";
const stepExecLog = createLogger("step-session-executor");
@@ -752,8 +753,11 @@ export class StepSessionExecutor {
for (const [stepIdx, worktreePath] of this.parallelWorktrees) {
try {
if (existsSync(worktreePath)) {
await execAsync(`git worktree remove "${worktreePath}" --force`, {
cwd: this.options.rootDir,
await removeWorktree({
worktreePath,
rootDir: this.options.rootDir,
settings: this.options.settings,
taskId: this.options.taskDetail.id,
});
} else {
stepExecLog.warn(`Parallel worktree for step ${stepIdx} already removed: ${worktreePath}`);
@@ -1244,8 +1248,11 @@ Follow instructions precisely and avoid unrelated changes.`,
if (worktreePath !== this.options.worktreePath) {
try {
if (existsSync(worktreePath)) {
await execAsync(`git worktree remove "${worktreePath}" --force`, {
cwd: this.options.rootDir,
await removeWorktree({
worktreePath,
rootDir: this.options.rootDir,
settings: this.options.settings,
taskId: this.options.taskDetail.id,
});
}
const branch = this.parallelBranches.get(stepIdx);