fix(FN-827): fix orphaned pause path so gracefully-paused tasks return to todo

- Fix executor bug where tasks paused during execution with a graceful session exit were silently dropped instead of moved back to todo
- When session.dispose() resolves the prompt without throwing, the paused-aborted flag now triggers moveTask(todo) so the scheduler can resume after unpause
- Add executor test suite covering pause via graceful exit, pause via abort error, and pause during session disposal
- Document corrected pause/unpause behavior for in-progress tasks in README and AGENTS.md
This commit is contained in:
gsxdsm
2026-04-03 22:09:56 -07:00
parent acfeea4fd3
commit a907256bab
5 changed files with 114 additions and 2 deletions

View File

@@ -640,9 +640,14 @@ export class TaskExecutor {
return;
}
// If paused during execution, don't move to in-review
// If paused during execution, move to todo so the scheduler can resume
// after unpause. This path fires when session.dispose() causes the
// prompt to resolve gracefully instead of throwing.
if (this.pausedAborted.has(task.id)) {
this.pausedAborted.delete(task.id);
executorLog.log(`${task.id} paused (graceful session exit) — moving to todo`);
await this.store.logEntry(task.id, "Execution paused — agent terminated, moved to todo");
await this.store.moveTask(task.id, "todo");
return;
}