Skip to content

_pick_next_task resumes IN_PROGRESS tasks before scanning for PENDING (closes #999)#1000

Merged
FidoCanCode merged 1 commit into
mainfrom
fix-pick-next-task-resumes-in-progress
Apr 26, 2026
Merged

_pick_next_task resumes IN_PROGRESS tasks before scanning for PENDING (closes #999)#1000
FidoCanCode merged 1 commit into
mainfrom
fix-pick-next-task-resumes-in-progress

Conversation

@FidoCanCode
Copy link
Copy Markdown
Owner

@FidoCanCode FidoCanCode commented Apr 25, 2026

Summary

Closes #999 — confusio worker deadlock where an IN_PROGRESS task was invisible to _pick_next_task and the #989 promote gate (correctly) refused to promote past it.

Diagnosis

Trace from ~/log/fido.log, ~23:44Z–23:55Z (10 min stuck loop on PR #288):

rescope_before_pick: fewer than 2 pending tasks — skipping
checking: ci → green
checking: tasks
PR #288: 2 tasks still pending or in-progress — not promoting yet
   ← idle wait 60s → identical loop

execute_task returned 0 every cycle because _pick_next_task filtered to status == PENDING only. The active task was IN_PROGRESS (left there by an earlier iteration that ended without claude running ./fido task complete). Combined with #989's promote gate, the worker had no way out.

Before #989 this was masked — the promote gate let the in_progress task slip through and the PR got marked ready while work was still in flight (the original #988 symptom). #989 closed that hole; this PR fixes the picker so the cycle completes.

Fix

_pick_next_task now treats IN_PROGRESS as the highest-priority candidate (resume what we already started), then falls back to CI tasks, then list-order PENDING. ASK/DEFER prefixes still suppress IN_PROGRESS — those signals mean a task is waiting for a human, not a signal to resume.

Test plan

  • 4 new TestPickNextTask cases: IN_PROGRESS over PENDING, IN_PROGRESS over CI, lone IN_PROGRESS returned, ASK-prefixed IN_PROGRESS still suppressed
  • 15 existing TestPickNextTask cases still pass
  • ./fido ci green
  • Live verification: bring fido up, confirm confusio's stuck task 1/2 — Extend validation scripts resumes within one worker cycle (≤60s) instead of looping indefinitely

🤖 Generated with Claude Code

…closes #999)

confusio worker stuck looping every 60s on PR #288 with no task progress
for ~10 minutes. Trace showed `execute_task` returning 0 every cycle
while the active task remained `in_progress`, then the promote gate
(added in #989) correctly seeing the in_progress task and refusing to
promote past it. Deadlock: worker can neither pick up the in_progress
task nor advance to merge.

Root cause: `_pick_next_task` filtered tasks to `status == PENDING` only,
so any task left in_progress by an iteration that ended abnormally
(subprocess crash, fido self-restart, kill) became invisible to the
picker. Before #989 this was masked because the promote gate let the
in_progress task slip through; #989 closed that hole and exposed the
picker's blind spot.

Fix: include IN_PROGRESS in the eligible candidates and prioritise it
over PENDING — finishing what we already started keeps tasks.json
honest before we reach for new work. ASK/DEFER prefixes still suppress
IN_PROGRESS (those signals mean a task is awaiting a human, not a
signal to resume).

Tests: 4 new TestPickNextTask cases covering IN_PROGRESS over PENDING,
IN_PROGRESS over CI-PENDING, lone IN_PROGRESS returned, and
ASK-prefixed IN_PROGRESS still suppressed. Existing 15 cases still
pass.
@FidoCanCode FidoCanCode force-pushed the fix-pick-next-task-resumes-in-progress branch from 43cd368 to 831c6eb Compare April 26, 2026 00:02
@FidoCanCode FidoCanCode marked this pull request as ready for review April 26, 2026 00:03
@FidoCanCode FidoCanCode requested a review from rhencke April 26, 2026 00:03
@FidoCanCode FidoCanCode merged commit 85952ba into main Apr 26, 2026
1 check passed
@FidoCanCode FidoCanCode deleted the fix-pick-next-task-resumes-in-progress branch April 26, 2026 00:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: in_progress task deadlock — _pick_next_task skips IN_PROGRESS, promote gate blocks on it

2 participants