taskplane 0.21.3 → 0.21.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -764,11 +764,29 @@ export function resolveCanonicalTaskPaths(
|
|
|
764
764
|
let resolvedFolder: string;
|
|
765
765
|
|
|
766
766
|
if (isWorkspaceMode) {
|
|
767
|
-
// Workspace mode:
|
|
768
|
-
//
|
|
769
|
-
//
|
|
770
|
-
//
|
|
771
|
-
|
|
767
|
+
// Workspace mode: check both the original source path AND the
|
|
768
|
+
// worktree-relative path. The task-runner may write .DONE to either
|
|
769
|
+
// location depending on how TASK_AUTOSTART resolves in the worker's
|
|
770
|
+
// context. Check worktree first (most common), then fall back to original.
|
|
771
|
+
const candidatePaths: string[] = [];
|
|
772
|
+
|
|
773
|
+
// Candidate 1: worktree-relative (task folder mirrored in worktree)
|
|
774
|
+
if (folderNorm.startsWith(repoRootNorm + "/")) {
|
|
775
|
+
const relPath = folderNorm.slice(repoRootNorm.length + 1);
|
|
776
|
+
candidatePaths.push(join(worktreePath, relPath));
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
// Candidate 2: original absolute path
|
|
780
|
+
candidatePaths.push(resolve(taskFolder));
|
|
781
|
+
|
|
782
|
+
// Use whichever has .DONE or STATUS.md; default to first candidate
|
|
783
|
+
resolvedFolder = candidatePaths[0];
|
|
784
|
+
for (const candidate of candidatePaths) {
|
|
785
|
+
if (existsSync(join(candidate, ".DONE")) || existsSync(join(candidate, "STATUS.md"))) {
|
|
786
|
+
resolvedFolder = candidate;
|
|
787
|
+
break;
|
|
788
|
+
}
|
|
789
|
+
}
|
|
772
790
|
} else if (folderNorm.startsWith(repoRootNorm + "/")) {
|
|
773
791
|
// Repo mode: task folder is inside the repo root.
|
|
774
792
|
// Translate to equivalent path in the worktree.
|
|
@@ -1287,6 +1305,23 @@ export async function executeLane(
|
|
|
1287
1305
|
// The task-runner writes .DONE via writeFileSync but never commits it.
|
|
1288
1306
|
if (pollResult.status === "succeeded") {
|
|
1289
1307
|
commitTaskArtifacts(lane, task, laneId);
|
|
1308
|
+
|
|
1309
|
+
// Reset worktree to clean state for the next task on this lane.
|
|
1310
|
+
// Without this, the next worker sees the previous task's modified
|
|
1311
|
+
// files and can get confused about which task it's working on.
|
|
1312
|
+
if (lane.tasks.indexOf(task) < lane.tasks.length - 1) {
|
|
1313
|
+
execLog(laneId, task.taskId, "resetting worktree for next task");
|
|
1314
|
+
const resetResult = runGit(["checkout", "--", "."], lane.worktreePath);
|
|
1315
|
+
const cleanResult = runGit(["clean", "-fd"], lane.worktreePath);
|
|
1316
|
+
if (!resetResult.ok || !cleanResult.ok) {
|
|
1317
|
+
execLog(laneId, task.taskId, "worktree reset warning", {
|
|
1318
|
+
resetOk: resetResult.ok,
|
|
1319
|
+
cleanOk: cleanResult.ok,
|
|
1320
|
+
resetErr: resetResult.stderr,
|
|
1321
|
+
cleanErr: cleanResult.stderr,
|
|
1322
|
+
});
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1290
1325
|
}
|
|
1291
1326
|
|
|
1292
1327
|
// If task failed or was paused, skip remaining tasks
|