Rerun --failed: skip jobs whose attempt changed, not only nonterminal ones #306

Closed
opened 2026-11-10 03:52:18 +00:00 by stephen · 1 comment
Owner

Follow-up to the Forgejo 17 rerun support (#297).

fj run rerun --failed keeps only job ids for the selected jobs, and skips a selected job that an earlier POST has rescheduled only while that job is not yet in a terminal state. If an earlier POST restarts a selected dependent and the dependent finishes before the next refresh, the loop reruns it again, repeating work. A slow refresh or an intervening request widens the window. The whole-run and Gitea failed reruns send a single POST and are not affected.

Fix: remember each selected job's original attempt (watch already tracks (job.id, attempt)) and skip a job whose attempt changed, including a job that is already terminal again. Extend the dependent-skip test with an incremented attempt that has already completed.

Also worth collecting here: the narrow race between a refresh and the POST, and acknowledgement loss (a POST accepted but the response lost).

Follow-up to the Forgejo 17 rerun support (#297). `fj run rerun --failed` keeps only job ids for the selected jobs, and skips a selected job that an earlier POST has rescheduled only while that job is not yet in a terminal state. If an earlier POST restarts a selected dependent and the dependent finishes before the next refresh, the loop reruns it again, repeating work. A slow refresh or an intervening request widens the window. The whole-run and Gitea failed reruns send a single POST and are not affected. Fix: remember each selected job's original attempt (`watch` already tracks `(job.id, attempt)`) and skip a job whose attempt changed, including a job that is already terminal again. Extend the dependent-skip test with an incremented attempt that has already completed. Also worth collecting here: the narrow race between a refresh and the POST, and acknowledgement loss (a POST accepted but the response lost).
Author
Owner

Fixed in v0.8.3 (#326, 50337f3): fj run rerun --failed now remembers each selected job's attempt and skips any job whose attempt changed, including one that already finished again. Closing. The two narrower cases listed at the end of this issue (the race between a refresh and the POST, and a POST accepted but its response lost) are not covered by that change; please open a new issue if either shows up.

Fixed in v0.8.3 (#326, 50337f3): `fj run rerun --failed` now remembers each selected job's attempt and skips any job whose attempt changed, including one that already finished again. Closing. The two narrower cases listed at the end of this issue (the race between a refresh and the POST, and a POST accepted but its response lost) are not covered by that change; please open a new issue if either shows up.
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
rasterstate/fj#306
No description provided.