Skip to content

Retry the site deploy when Cloudflare cannot find the uploaded Worker version - #6546

Merged
max-sixty merged 2 commits into
mainfrom
fix/issue-3826
Nov 20, 2026
Merged

max-sixty merged 2 commits into
mainfrom
fix/issue-3826

Conversation

@leaf-agent

@leaf-agent leaf-agent commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

publish-site fails when Cloudflare's Worker Versions API answers 100146 ("The requested Worker version could not be found") for the version wrangler deploy has just uploaded, and a later deploy of the same tree succeeds with no change here. This makes Deploy public Leaf pages deploy again on that answer, every 5 minutes until 30 minutes after the first 100146; any other failure, including a different Wrangler error, still fails the step on its first attempt. The job's timeout-minutes rises from 45 to 75 so that window fits beside the public verification's 15-minute --wait and the agent journey after it. This is the bounded retry the maintainer named on #3826 as the repair if the lookup failure recurred, and it recurred in run 44628090061.

Needs the control-plane owner's approval: it edits a workflow, so it isn't landing on review alone.

The window is sized to the outages seen so far. On Oct 24, run 40131829999's deploys about 12 minutes apart both failed before a third passed. On Nov 19, run 44628090061's rerun deployed at 22:47 UTC, 16 minutes after the first failure, and got 100146 again. In the last five successful runs the job took 11 to 14 minutes, about 8 of them before the deploy, so the worst case is about 8 + 30 + the verification's ~34 minutes, under 75.

Verified by running the step's script with the deploy command, sleep and date stubbed, each deploy taking a simulated minute:

  • Success on the first attempt exits 0 after one call.
  • 100146 then success exits 0 after two calls.
  • A different error exits 1 after one call.
  • 100146 every time exits 1 after six calls, with the last deploy ending 30 minutes after the first failure.

The match string [code: 100146] is the one in the failed run's log. set -o pipefail is needed because the step's default shell is bash -e, under which wrangler … | tee would report tee's status.

Closes #3826 — automated triage

… version

publish-site's deploy fails when Cloudflare's Worker Versions API answers
100146 for the version Wrangler just uploaded, and a later deploy of the
same tree succeeds. The step now deploys again, up to three attempts five
minutes apart, only on that answer; any other failure ends the step at once.

Refs #3826
@max-sixty

Copy link
Copy Markdown
Owner

@leaf-agent please widen the retry to cover the outages your description lists. Deploy again every 5 minutes until 30 minutes after the first 100146, and keep retrying only on [code: 100146]. Then raise the job's timeout-minutes so the window still fits beside the public check's 15-minute wait. In the last five successful runs the job took 11 to 14 minutes, about 8 of them before the deploy, so the worst case is about 8 + 30 + 15 minutes plus the deploys themselves, near 55. A timeout-minutes of 75 leaves room for that.

This was written by Claude Code on behalf of max-sixty

The deploy now retries Cloudflare's 100146 every 5 minutes until 30 minutes
after the first one, the window the maintainer asked for, since the Oct 24 and
Nov 19 outages both outlasted ten minutes. The job's timeout-minutes rises from
45 to 75 so that window fits before the public verification's 15-minute wait.
Any other deploy failure still fails the step on its first attempt.
@leaf-agent

Copy link
Copy Markdown
Collaborator Author

Done in f3556ec. The deploy now retries every 5 minutes until 30 minutes after the first 100146, still only on [code: 100146], and timeout-minutes is 75. I tested the script with the deploy stubbed. When every deploy answers 100146, it makes six attempts and stops with the last one ending 30 minutes after the first failure. The other three cases still behave as before. I've updated the description to match.

@max-sixty
max-sixty merged commit 1d236af into main Nov 20, 2026
5 checks passed
@max-sixty
max-sixty deleted the fix/issue-3826 branch November 20, 2026 00:30
max-sixty added a commit that referenced this pull request Nov 20, 2026
…oy.sh

Main's #6546 retries `publish-site`'s deploy when Cloudflare answers 100146 for the
version just uploaded, every 5 minutes until 30 minutes after the first, since its
outages have lasted over 15 minutes. This branch's script retried the same lookup
failure where it surfaces after the upload, as "not fully applied". The two are one
mechanism, so the script now retries either, 30 s after the first failure and then
every 5 minutes until 30 minutes after it, and `publish-site` and `deploy-dev.sh`
both run it. Checked against a stub wrangler: success, 100146 then success, two
half-applied deploys then success, and another error exiting at once.
max-sixty added a commit that referenced this pull request Nov 20, 2026
… Object scheduling (#6550)

Every leaf.page deploy was followed by 2–5 minutes in which container
starts failed ("Failed to start container"): Cloudflare activated the
Worker at once but rolled the image out over minutes, and the page store
refused the previous image. This moves the session object to
Cloudflare's Durable Object scheduling: `LeafSession` starts, proxies
and idles out its own container on the Container API (the deprecated
`@cloudflare/containers` SDK is removed), with the image from its own
Worker version, so a start after a deploy always runs the deployed
image. The image pre-build in `publish-site`, `--containers-rollout` and
`max_instances` go.

Closes #4081

To weigh:
- The new policy needs a new class (migration v3), so every visitor
starts once from the published page. `LeafWebsiteSession` stays as an
empty export: Cloudflare refuses to delete a class while its container
application stands, and refuses a version that omits it. Deleting both
is a follow-up.
- A container from before a deploy is still stopped at the session's
first request after it, and the store still refuses it meanwhile, so a
turn in progress is cut off. Keeping it running was built and tried
(first commit) and backed out (second): the Worker↔container interface
has no version, so an older container could be left unable to save.
- `worker/wrangler-deploy.sh` is now the one deploy retry, for
`publish-site` and `deploy-dev.sh`: it folds in main's 100146 retry
(#6546) and also reruns a deploy that uploaded the Worker but failed to
apply the container application, which wrangler does when the same
lookup outlasts its 2.5 s read-back (3 of 6 dev attempts). On
production's first deploy, which creates the new application, that rerun
is what gives the class a container, so the first retry comes after 30
s.

The maintainer asked for this on a Leaf page. Tests: worker vitest,
`tests/process/website_server`, `leaf-dev site verify website-worker`,
and three deploys to `leaf-website-dev` with a visitor's tab held open:
no failed request to a visitor, one reload at the deploy, every sent
question answered.

> _This was written by Claude Code on behalf of max-sixty_
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.

ci-fix: publish-site cannot read uploaded Worker version

2 participants