Skip to content

feat(deploy): retry a first deploy that loses Cloudflare's own race (0.19.0) - #18

Merged
pullely merged 2 commits into
mainfrom
claude/lane-install-deploy-retry
Oct 14, 2026
Merged

pullely merged 2 commits into
mainfrom
claude/lane-install-deploy-retry

Conversation

@pullely

@pullely pullely commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

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. 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-turbo and cloudflare-workers-assets-turbo now 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.sh passes: every composition contract is valid and the dry-run publish succeeds. Version 0.19.0.

🤖 Generated with Claude Code

varahul and others added 2 commits October 15, 2026 00:56
…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>
@pullely
pullely merged commit 1a9dfe7 into main Oct 14, 2026
3 checks passed
@pullely
pullely deleted the claude/lane-install-deploy-retry branch October 14, 2026 19:31
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants