Skip jobs whose attempt changed when rerunning failed jobs (#306) #326

Merged
stephen merged 1 commit from fj-306-rerun-attempt into main 2026-11-12 11:38:59 +00:00
Owner

Fixes the main point of #306.

fj run rerun --failed on 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).

Fixes the main point of #306. `fj run rerun --failed` on 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).
Skip jobs whose attempt changed when rerunning failed jobs (#306)
All checks were successful
ci / check (pull_request) Successful in 15m35s
ci / live-e2e (pull_request) Successful in 3m26s
ci / coverage (pull_request) Successful in 5m37s
21570065eb
gerri approved these changes 2026-11-12 11:18:24 +00:00
gerri left a comment

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 21570065eb at 2026-11-12T11:18:23Z by codex exec (read-only sandbox).

Automated Codex review (read-only) of head 21570065ebb2ef7a8d9091bbe996772a07dda499. 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 21570065ebb2ef7a8d9091bbe996772a07dda499 at 2026-11-12T11:18:23Z by codex exec (read-only sandbox).
Sign in to join this conversation.
No description provided.