Skip jobs whose attempt changed when rerunning failed jobs (#306) #326
Loading…
Reference in a new issue
No description provided.
Delete branch "fj-306-rerun-attempt"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes the main point of #306.
fj run rerun --failedon Forgejo 17 posts one rerun per selected job, refreshing the job list before each POST so a dependent that an earlier POST already restarted is not posted again. The skip only held while that job was not yet in a terminal state. A dependent that was restarted and finished again before the next refresh looked like an ordinary failed job and was rerun a second time.Each selected job now carries its original attempt, and the loop skips a job whose attempt changed, whatever its status. Jobs whose attempt is unchanged are rerun as before. If the server omits the attempt, both sides read 0 and the old nonterminal check still applies.
Tests: a dependent whose new attempt has already finished is not posted (fails on the old code with a second POST), and jobs with unchanged attempts are all rerun. The existing nonterminal-dependent test is unchanged.
Not addressed here, still on #306 as noted there: the narrow window between the refresh and the POST, and an accepted POST whose response is lost (the job would be posted again on a retry of the command).
Automated Codex review (read-only) of head
21570065eb.No new correctness, security, or test findings against the standards. The attempt guard preserves the missing-attempt fallback, and the regression test exercises the production adapter.
The refresh-to-POST race and lost-response retry remain accepted low-severity edge cases deferred to #306.
BLOCKING: 0
Reviewed head
21570065ebat 2026-11-12T11:18:23Z by codex exec (read-only sandbox).