Repository navigation
feat(deploy): retry a first deploy that loses Cloudflare's own race (0.19.0) - #18
Merged
Merged
Conversation
…0.19.0) A brand-new worker's first `wrangler deploy` can fail right after the upload with "This Worker does not exist on your account" (code 10007): the follow-up read lands before the create is visible. Seen on pullely/cirrus-timing-3's fleet landing, where it cost the convergence a whole resume (~2-4 min). The deploy is idempotent, so cloudflare-worker-turbo and cloudflare-workers-assets-turbo now try it three times, 10 s then 20 s apart, before failing the step. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The shared install (scope: lane) needs an orun that lets a lane-scoped step follow the job's setup actions; it ships with that orun. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
krambertech
added a commit
to krambertech/lymi
that referenced
this pull request
Oct 25, 2026
## Summary - The app preview job now creates a preview Worker whenever its workers.dev and preview URLs are off, not only when the Worker is missing, so a half-created Worker repairs itself on the next run. - The create step retries `wrangler deploy` up to three times, so a new pull request's first run survives Cloudflare's 10007 race instead of failing. ## Why Since about 21:00 UTC on 24 Oct, a brand-new preview Worker's first `wrangler deploy` uploads the script and then fails on Wrangler's next call, `GET /workers/workers/lymi-app-pr-<n>`, with "This Worker does not exist on your account. [code: 10007]". That call is Wrangler's read before it enables workers.dev and preview URLs, so the Worker is left with both off. Every rerun then saw the Worker as existing, skipped the create step, and `wrangler versions upload --preview-alias preview` reported no preview URL because `previews_enabled` was false. - First attempts: PR 1024 (job 120988585980), 1025 (job 120988089871), 1026 (job 120992039999) and 1027 (job 120991929905) all log `Uploaded lymi-app-pr-<n>` followed by the 10007 error. - Reruns on the same PRs skip the create step, and the upload prints no `Version Preview URL`, so `preview-url.mjs` throws. - PR 1024 recovered only after its Worker was deleted and recreated at 21:46, when the first deploy happened to win the race. Wrangler is pinned at 4.149.0 in the lockfile for passing and failing runs, so the change is on Cloudflare's side. A [similar report](sourceplane/stack-tectonic#18) fixes the same race by retrying the first deploy. Open PRs whose preview Worker is already stuck, such as 1026 and 1027, recover after a rebase onto this change: preparing the preview sees preview URLs off and redeploys. ## Instrumentation None: this changes CI provisioning only, with no learner behaviour or product event. ## Verification - `node --test scripts/app-preview-infrastructure.test.mjs`: 17 pass. The new test for a Worker that exists with preview URLs off fails on `main` and passes here, as do the two updated readiness tests. - `pnpm verify:changed` handed over to the full gate (the diff touches `ci.yml`) and failed locally in `apps/web` typecheck: this worktree's install predates `@cloudflare/vitest-plugin`. Left to CI, which installs fresh. - This pull request's own `app preview` job ([job 121136623742](https://github.com/krambertech/lymi/actions/runs/40181884360/job/121136623742)) passed on its first run: the create step deployed `lymi-app-pr-1030`, the upload printed `Version Preview Alias URL: https://preview-lymi-app-pr-1030.k-porshnieva.workers.dev`, and the sign-in and seeded-data checks passed. That first deploy did not hit the 10007 race, so the retry was not exercised. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A brand-new worker's first
wrangler deploycan fail right after the upload with:The follow-up read lands before the create is visible. It hit
pullely/cirrus-timing-3's fleet landing (run 38545219854, attempt 1), and the convergence paid a whole resume for it, about 2 to 4 minutes.The deploy is idempotent, so
cloudflare-worker-turboandcloudflare-workers-assets-turbonow try it three times, 10 s then 20 s apart, before failing the step. The smoke step already had retry-with-backoff since 0.18.2.scripts/verify.shpasses: every composition contract is valid and the dry-run publish succeeds. Version 0.19.0.🤖 Generated with Claude Code