@masslessai/push-todo 3.6.6 → 3.6.8
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.
- package/lib/daemon.js +11 -2
- package/package.json +1 -1
package/lib/daemon.js
CHANGED
|
@@ -961,12 +961,14 @@ function handleTaskCompletion(displayNumber, exitCode) {
|
|
|
961
961
|
});
|
|
962
962
|
}
|
|
963
963
|
|
|
964
|
-
// Cleanup
|
|
964
|
+
// Cleanup internal tracking
|
|
965
965
|
taskDetails.delete(displayNumber);
|
|
966
966
|
taskLastOutput.delete(displayNumber);
|
|
967
967
|
taskStdoutBuffer.delete(displayNumber);
|
|
968
968
|
taskProjectPaths.delete(displayNumber);
|
|
969
969
|
|
|
970
|
+
// Always clean up worktree — the branch preserves all committed work.
|
|
971
|
+
// On re-run, createWorktree() recreates from the existing branch.
|
|
970
972
|
cleanupWorktree(displayNumber, projectPath);
|
|
971
973
|
updateStatusFile();
|
|
972
974
|
}
|
|
@@ -1213,12 +1215,19 @@ async function mainLoop() {
|
|
|
1213
1215
|
function cleanup() {
|
|
1214
1216
|
log('Daemon shutting down...');
|
|
1215
1217
|
|
|
1216
|
-
// Kill running tasks
|
|
1218
|
+
// Kill running tasks and mark them as failed in Supabase
|
|
1217
1219
|
for (const [displayNumber, taskInfo] of runningTasks) {
|
|
1218
1220
|
log(`Killing task #${displayNumber}`);
|
|
1219
1221
|
try {
|
|
1220
1222
|
taskInfo.process.kill('SIGTERM');
|
|
1221
1223
|
} catch {}
|
|
1224
|
+
// Mark as failed so the task doesn't stay as 'running' forever
|
|
1225
|
+
const duration = Math.floor((Date.now() - taskInfo.startTime) / 1000);
|
|
1226
|
+
updateTaskStatus(displayNumber, 'failed', {
|
|
1227
|
+
error: `Daemon shutdown after ${duration}s`
|
|
1228
|
+
});
|
|
1229
|
+
const projectPath = taskProjectPaths.get(displayNumber);
|
|
1230
|
+
cleanupWorktree(displayNumber, projectPath);
|
|
1222
1231
|
}
|
|
1223
1232
|
|
|
1224
1233
|
// Clean up files
|