Retry and bound the fj downloads #1
Loading…
Reference in a new issue
No description provided.
Delete branch "rel-cl/plat-924-curl-retry"
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?
Classification: environment (the forge answered 504 for several minutes around 06:30 UTC on 2026-11-22; flux's audit lost a read in the same window) with a missing defence here. Run 506 of fjord-docs' fj reference job: 'downloading fj-v0.8.4-linux-x86_64.tar.gz ... curl: (22) The requested URL returned error: 504', after 137 s, then 'exitcode 22'. curl was called without retries or limits.
Fix (scripts/fetch.sh, sourced by setup.sh):
Automated Codex review (read-only) of head
3363b717a2.Medium scripts/setup.sh:27: The promised download deadline must bound the whole fetch.
--max-time 300resets for every retry. With a workflow token, the anonymous request and token fallback can each take four 300-second attempts, plus retry delays. A hung forge can therefore hold a single fetch for over 40 minutes, rather than the 300 seconds stated in the changelog. This affects the default latest lookup and both downloads during the same kind of forge outage this PR addresses. Enforce a total deadline across retries and the token fallback, and test that deadline.Low, edge case, scripts/setup.sh:36: A successful retry must supply one complete response. The latest-version response goes to a pipe, so curl cannot discard bytes already written by a timed-out attempt before retrying. A partial JSON response followed by a successful response can be combined and parsed as the wrong tag or fail resolution. The asset and checksum paths use output files, so this pipe issue is specific to version lookup. Fetch the lookup into a temporary file that is reset between attempts, then parse only the successful response.
Low, edge case, scripts/setup.sh:27: Retry behavior must match the documented status codes. Curl retries HTTP 500, 502, 503 and 504, but not every 5xx as the PR body claims. For example, repeated 507 responses receive no retry. Either implement the broader policy or narrow the claim.
Low, edge case, tests/run.sh:118: Tests must exercise the failure behavior they claim. Both new checks inspect arguments passed to a fake curl that always succeeds. They cannot establish that a transient failure is retried, that a permanent failure exits, or that the total deadline holds. Exercise the production fetch through a controlled HTTP server with transient and permanent responses, covering the version lookup, asset, checksum, and token fallback.
BLOCKING: 1
Reviewed head
3363b717a2at 2026-11-22T17:56:50Z by codex exec (read-only sandbox).gerri, all four addressed (two pushes: the first went out with the offline suite's fake curl still writing the version lookup to stdout instead of its -o file, so run.sh failed on it; the second is that fix, and the whole suite passes).
Automated Codex review (read-only) of head
f568978191.High scripts/fetch.sh:18: Invariant: supported platforms must be able to fetch releases. On macOS runners using the system Bash 3.2,
set -utreats the emptyautharray expansion as an unbound variable. Every fetch starts anonymously, so the version lookup and both downloads fail before curl runs. This breaks the action on its supported Darwin platforms. Guard the empty array expansion or construct the anonymous and authenticated curl calls without expanding an empty array, and test with Bash 3.2.Medium scripts/fetch.sh:18: Invariant: a retryable timeout gets another attempt within the fetch budget. The first curl receives the entire remaining 300-second deadline. If the forge accepts a connection but stops responding, that attempt consumes the budget, leaving no time for a retry or token fallback. A transient stall can therefore fail a real job even if the forge recovers immediately after the timeout, contrary to this PR’s stated timeout retry behavior. Reserve time for subsequent attempts and the fallback, and assert the request count in the hang test. The same helper affects the version lookup and both downloads.
BLOCKING: 2
Reviewed head
f568978191at 2026-11-22T18:46:25Z by codex exec (read-only sandbox).gerri, both fixed in one push.
Automated Codex review (read-only) of head
dd33409bbb.Medium: scripts/fetch.sh: Invariant: retry behavior must match the promised recovery policy. The PR promises three retries, but the loop makes three total attempts, allowing only two retries per anonymous or authenticated request. With the default configuration, a forge returning three consecutive 504s and then recovering will still fail the version lookup or download instead of making the promised fourth request. This is directly in the PR’s outage-recovery scope. Make the initial attempt plus three retries, and test recovery on the fourth request.
Low, edge case: scripts/fetch.sh: Invariant: a failed output write must not be reported as a successful fetch.
fetchignores a failedcatand returns success after removing the temporary file. For example, a full runner filesystem during the copy can leave an incomplete asset or checksum file while reporting success. All three callers use this helper. Check the copy result, clean up, and return failure if it fails.BLOCKING: 1
Reviewed head
dd33409bbbat 2026-11-22T19:19:24Z by codex exec (read-only sandbox).gerri, both fixed in one push (
0180490; the first attempt to push failed on an ssh error and nothing reached the remote, so this is the one push).Automated Codex review (read-only) of head
0180490197.Medium scripts/fetch.sh:17: A healthy response must have enough time to complete within the advertised timeout. With the usual workflow token present, the first anonymous attempt gets only 37 seconds, and subsequent attempts get similar or shorter limits. A Forgejo release download that takes 40 seconds on a slow runner or during degraded service will repeatedly time out, even though it would complete within the PR body’s stated 300-second
--max-time. This affects the version lookup and both downloads, and belongs in this PR because the new timeout causes jobs that previously succeeded to fail. Allocate a sufficient per-attempt budget while retaining a bounded total deadline, and test a slow but successful response through the setup path.Low scripts/fetch.sh:24: Edge case. Retry policy and user-facing claims should agree. The PR body says all 5xx responses are retried, but 501, 505, 507 and other unlisted 5xx responses immediately end an ask. For example, a temporary 507 from a private mirror gets no retry. Either retry all 5xx responses or correct the PR body to state the deliberately narrower policy.
BLOCKING: 1
Reviewed head
0180490197at 2026-11-22T19:56:57Z by codex exec (read-only sandbox).gerri, both fixed in one push (
ae140bb).The whole suite exits 0 (17 fetch checks and the 11 of run.sh); fetch also runs under a real bash 3.2.57 with a stub curl.
Automated Codex review (read-only) of head
ae140bbb71.BLOCKING: 0
Reviewed head
ae140bbb71at 2026-11-22T20:26:36Z by codex exec (read-only sandbox).