Repository navigation
Conversation
Cloudflare's Worker version list can trail a write by minutes. Before the upload, wait while the list lacks the active version. After the upload, wait while the list still equals the baseline, on a schedule of about 5.5 minutes instead of 250 ms and 500 ms. Failed reads keep their two quick retries. Refs voidzero-dev#891
0froq
left a comment
There was a problem hiding this comment.
Looked into this and commented
The version list reads page 2 only above 10 versions. If a write lands between the two page reads, the pages overlap and the read fails. That failure ended the pre-upload check with no wait and left only two quick retries after the upload. The runner now marks this failure as version-history-changed, and both waits retry it on the same schedule as a stale list. Other failures keep their behavior, and an overlap that outlasts the schedule still stops with inheritance-source-unavailable. Export STALE_VERSION_HISTORY_DELAYS_MS from the package entry. Refs voidzero-dev#891
|
in !['not-found', 'durable-migration', 'containers-unavailable'].includes(envelope.failure))should include 'version-history-changed'. Not reachable today (the cf runner is in-process), but the whitelist and the failure union in Thank you! |
|
Slop review:
|
The process envelope decoder accepted only three of the four runner failures, so a version-history-changed envelope from a child process would have been rejected as invalid. The cf runner is in-process today, so this path was not reachable. The accepted failures are now a record keyed by the CloudflareCommandResult failure union, so a failure added to the union fails the typecheck until it is accepted here too. Refs voidzero-dev#891
|
Fixed in f72b076. |
A rollback during either version list wait was not seen until after the candidate receipt was saved with the old active version as its parent. The deploy then stopped, and the next deploy failed on that receipt. After a wait, production is now read again before the upload and before the receipt is saved. If it changed, the deploy stops with deployment-changed and saves no receipt. A rollback to a version older than the ten listed versions can never appear in the list, but the pre-upload check waited the whole schedule for it. The active version's number is now read with versions.view, and the deploy waits only when that number is not below the list's lowest number. A number that cannot be read keeps the wait. Refs voidzero-dev#891
|
Fixed in e4fbe90. Rollback during a wait. After the pre-upload wait, The same hazard exists on Rollback beyond the listed versions. This applies to the pre-upload wait only. The post-upload wait compares against the pre-upload baseline and does not look for the active version. When the list does not contain the active version, the deploy now reads that version once with |
cpojer
left a comment
There was a problem hiding this comment.
Looks good to me, I'd like a review by @Brooooooklyn before we merge.
# Conflicts: # packages/deploy-cloudflare/src/version.ts
… upload - After the upload, a list that ends below the pre-upload baseline and agrees with it on every shared number is an older snapshot, not a concurrent write. Wait for it like an unchanged list instead of failing with inheritance-source-changed. - Read production again only after a wait for a lagging list. The quick retries of a failed read no longer add a status read that could fail a deploy. - Report the wait when it starts after a failed read, not only when the first read is stale. - Fix lint rules enabled on main since the branch was opened. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Fixes #891 for the version-list paths. The
triggers-failedcase in the issue is not changed here.Change
Cloudflare's Worker version list can trail a write by minutes. The deploy now waits for it in the two places where the expected state is known:
deployments statusreported. This read had no retry.versions.listfails because its two pages disagreed ("The Cloudflare Worker version history changed during inspection"). The runner now marks that failure asversion-history-changed, and it is retried on the same schedule. Page 2 is read only above 10 versions, so this is theinheritance-source-unavailableshape in the second report on Cloudflare deploy stops on a lagging Worker version list (inheritance-source-changed, triggers-failed) #891.After either wait, production is read again: before the upload, and before the candidate receipt is saved. If a rollback or another deploy changed it during the wait, the deploy stops with
deployment-changedand saves no receipt, so the next deploy does not find a receipt with the wrong parent. Production is read again only after a wait for a lagging list, not after the quick retries of a failed read. If that read fails after the upload, the deploy stops withstatus-failed("uploaded, but Cloudflare deployment status could not be verified before activation"); a handoff deploy keeps its verified receipt so the retry can use it.These waits use
STALE_VERSION_HISTORY_DELAYS_MS: 250 ms doubling up to 30 s, 17 waits, about 5.5 minutes in total. Each wait checksverifyUploader(), and the first wait for a lagging list reports progress. The schedule can be overridden with the newversionHistoryRetryDelaysMsoption.STALE_VERSION_HISTORY_DELAYS_MSis exported from the package entry.Why this length: in the runs in #891 a new version was still missing 52 s after creation and was listed within about 4.5 minutes. #880 and #868 retried for a second or less, which does not reach that. If maintainers want a shorter cap, change the constant.
What does not change
inheritance-source-unavailable, before or after the upload. Nothing is uploaded when the pre-upload wait runs out, on handoff and direct deploys alike. (Before, a direct deploy could go on to pin the active secrets and upload.)numberis read withversions.view; the wait happens only when that number is not below the list's lowest number. If the number cannot be read (failed or thrown read, or no integernumber; the API marks the field optional), it is read again on the next wait, and the deploy keeps waiting while it stays unreadable, since a version the list trails may not be readable yet either.void linkkeeps a saved candidate receipt only when its parent is still the active version.stabilizeCloudflareVersionTriggersis untouched. The logs in Cloudflare deploy stops on a lagging Worker version list (inheritance-source-changed, triggers-failed) #891 do not show what its reads returned.Tests
packages/deploy-cloudflare/test/unit/version.test.ts:packages/void/test/unit/cf-version-runner.test.tschecks theversion-history-changedmarker.deployment-changed, andrecordVerifiedCandidateis never called.versions.viewstill waits the whole schedule.The new pre-upload tests and the changed stale-list case fail on
mainand pass here (5 failures without the change; measured before the page-overlap commit).Verified locally
Run in a shell with no
CLOUDFLARE_*,CF_*or wrangler variables (env | grep -ciE 'cloudflare|^CF_|wrangler'printed 0). The tests injectrunWrangler, so nocforwranglerprocess starts.vp test run packages/deploy-cloudflare/test/unit/version.test.ts: 237 passed after the page-overlap commit (231 before)vp check,vp run check:types(35/35) andvp test run packages/deploy-cloudflare packages/deploy-core packages/void/test/unitwere re-run: 10069 passed, 17 failed. The 17 areinit.test.ts(16) andnitro.test.ts(1), which also fail on the commit before this one in the same shell.vp check: no warnings, lint errors or type errorsvp run check:types: 35/35 successfulvp run test:all: 92 of 93 tasks passed. The one failing task wasplatform-api-integration-threads, 12 tests, because Playwright's Chromium was not installed. Afterplaywright install chromiumthe six failing files passed (204 tests).