You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CI: retry the website deploy step on a transient Cloudflare failure, with a bounded window #970
✘ [ERROR] A request to the Cloudflare API (/accounts/…/workers/scripts/nostream-web-pr-969/assets-upload-session) failed.
An unknown error has occurred. [code: 10013]
The build had already succeeded and 164 assets were read. The run one minute earlier on the same branch passed, the failing commit only deleted five lines from Peering.astro, and the next push deployed successfully — so this is a transient upstream failure, not a defect in the site or the workflow.
One transient failure out of roughly five runs is enough that the fix is worth having, but only if it does not turn a visible outage into an invisible one.
What to build
A retry that wraps the deploy step — not the build — in both deploy-website-preview.yml and deploy-website.yml:
3 attempts, backoff of about 10 s then 30 s so the total added time is bounded at roughly a minute.
A per-attempt timeout and a step-level timeout-minutes, so a hung upload cannot burn the job.
Retry only transient signals: code: 10013, an HTTP 5xx, or a connection reset. An authentication failure, a missing environment, or a wrangler validation error must fail on the first attempt — retrying those triples the noise and delays the real message.
A ::warning:: annotation whenever an attempt is not the first, naming the attempt number and the reason. Without this the retry hides the flake rate entirely, and we would never learn that Cloudflare is degrading or that a real limit is approaching.
Implementation notes
Both workflows deploy the same way (npx wrangler deploy --config … --name …), so the retry belongs in one shared script under .github/scripts/, invoked by both. Two copies will drift.
Prefer a shell loop over a third-party retry action: it keeps the supply chain as it is, and it makes the transient-signal filter ours to write and read.
The script should be testable the way the release tag step is — a test that executes the script against a stub wrangler that fails once and then succeeds, plus one that fails with a 401 and asserts there was no second attempt.
Add one shared script under .github/scripts/ that runs npx wrangler deploy in a shell loop, and call it from both deploy-website-preview.yml and deploy-website.yml, so the two cannot drift.
Make 3 attempts with about 10 s and then 30 s of backoff, with a per-attempt timeout and a step-level timeout-minutes.
Retry only on transient signals: code: 10013, an HTTP 5xx, or a connection reset. An auth failure, a missing environment or a wrangler validation error fails on the first attempt.
Print a ::warning:: annotation on every retry with the attempt number and the reason, so the flake rate stays visible.
Add tests that run the script against a stub wrangler: one that fails once and then succeeds, and one that fails with a non-transient error and must not retry.
No third-party retry action, so the supply chain stays as it is.
Activity
tejasvasingh2004 commentedon Oct 25, 2026
Hi! I'd like to work on this.
My plan, following the implementation notes:
.github/scripts/that runsnpx wrangler deployin a shell loop, and call it from bothdeploy-website-preview.ymlanddeploy-website.yml, so the two cannot drift.timeout-minutes.code: 10013, an HTTP 5xx, or a connection reset. An auth failure, a missing environment or a wrangler validation error fails on the first attempt.::warning::annotation on every retry with the attempt number and the reason, so the flake rate stays visible.wrangler: one that fails once and then succeeds, and one that fails with a non-transient error and must not retry.No third-party retry action, so the supply chain stays as it is.
Could you assign this to me?