diff options
Diffstat (limited to 'scripts/next-task')
| -rwxr-xr-x | scripts/next-task | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/scripts/next-task b/scripts/next-task index 9df09f0..c36fc23 100755 --- a/scripts/next-task +++ b/scripts/next-task @@ -32,7 +32,9 @@ fi if [ -z "$next_task" ]; then # 4. No child/sibling found: fall back to highest-priority oldest PENDING task - FALLBACK_SQL="SELECT id FROM tasks WHERE state IN ('PENDING', 'QUEUED') AND id != '$id' + # 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' ORDER BY CASE priority WHEN 'critical' THEN 4 |
