summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-03-26 08:22:52 +0000
committerPeter Stone <thepeterstone@gmail.com>2026-03-26 08:22:52 +0000
commit8bb9ac1328fc4f6b8d8e7aae0d6ea706e502c245 (patch)
tree059e3042afdf5511430d409096b1bd4900e70722 /scripts
parent5f3e9900358649f1356d0a242e643790e29e3701 (diff)
fix: next-task fallback should not exclude previously-executed tasks
The `id NOT IN (SELECT task_id FROM executions)` guard prevented retried tasks (FAILED→PENDING) from ever being picked up by start-next-task. Only the rejection_comment check is needed to avoid re-running rejected tasks. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/next-task5
1 files changed, 2 insertions, 3 deletions
diff --git a/scripts/next-task b/scripts/next-task
index c36fc23..697de11 100755
--- a/scripts/next-task
+++ b/scripts/next-task
@@ -32,9 +32,8 @@ fi
if [ -z "$next_task" ]; then
# 4. No child/sibling found: fall back to highest-priority oldest PENDING task
- # Exclude tasks that have a rejection comment or have already been executed
- # to avoid auto-approving rejected tasks.
- FALLBACK_SQL="SELECT id FROM tasks WHERE (state = 'PENDING' AND (rejection_comment IS NULL OR rejection_comment = '') AND id NOT IN (SELECT task_id FROM executions)) OR state = 'QUEUED'
+ # Exclude tasks with a rejection comment to avoid auto-approving rejected tasks.
+ FALLBACK_SQL="SELECT id FROM tasks WHERE (state = 'PENDING' AND (rejection_comment IS NULL OR rejection_comment = '')) OR state = 'QUEUED'
ORDER BY
CASE priority
WHEN 'critical' THEN 4