Skip to content

Let a previous-release leaf.page container start and be recognized during a rollout - #6457

Merged
max-sixty merged 3 commits into
mainfrom
inbox-dot-resolve
Nov 19, 2026
Merged

max-sixty merged 3 commits into
mainfrom
inbox-dot-resolve

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

After a deploy, Cloudflare runs the new Worker while some session containers still start on the previous image. The edge replaces such a container's answers (rollingOut), but only once the container answers with its Leaf-Release. Right after #6441 deployed (2026-11-19 01:06 UTC), previous-image containers read the new Durable Object's /records snapshot, took its new records key for a page root, and exited on KeyError: 'records' before serving. The edge passed the Durable Object's 500 through, and a visitor on /how-it-works saw "Hit a problem — trying again" until the rollout finished.

  • Each page-store request now names its container's release. The leaf-state.internal handler refuses another release with 409 before any operation, and restore takes that refusal as a cue to start without the session's record and without publishing. That one check replaces the per-operation release check, so the release fields in the publication and drafts bodies and the leaf_pages.release column are gone.
  • A server that runs a release now names it on every answer. Before, a previous-image container asked for a page only the new release has answered 404 without the header, and the edge passed that through too.

To weigh: the deploy of this change still crashes previous-image containers once, since they send no header and treat the 409 as a failure. A stale sample URL can still wake an older release's Durable Object with the current image, which the header check accepts; that is left as a follow-up.

Codex reviewed the first commit and found the 404 case. Tests: pnpm run check:worker, tests/process/website_server, and the saved-record journey test.

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

…ng a rollout

Cloudflare activates a new Worker before its container image rolls out, so for
some minutes after a deploy a session's container can start on the previous
image. The edge already replaces such a container's answers (`rollingOut`),
but only once the container answers. On 2026-11-19 at 01:06 UTC, right after
#6441 deployed, previous-image containers read the new Durable Object's
`/records` snapshot, now `{"records": ..., "drafts": ...}`, took `records` for
a page root, and exited on `KeyError: 'records'` before serving. With no
answer to recognize, the edge passed the Durable Object's 500 through, and a
visitor on /how-it-works saw "Hit a problem — trying again" on `api/state`,
`api/news`, `api/event` and `api/user-view` until the rollout finished.

Each store request now names its container's release in `Leaf-Release`. The
`leaf-state.internal` handler refuses a release other than the Worker's with
409 before any operation, and `restore` takes that refusal as a cue to start
without the session's record and without publishing (`page_restore_refused`).
The container then boots, its answers name its own release, and the edge's
rollout path takes over, whatever the new release changed in the record.

That one check replaces the per-operation release check: the `release` fields
in the publication and drafts bodies, the `leaf_pages.release` column, and the
release comparison in `PageStore.checkRelease` (now `checkRoot`, at prepare and
drafts saves) are gone. A container already on the previous image when this
deploys sends no header, so it is refused and still fails to start once, as
on 2026-11-19.

Behavior changes the tests now hold: a store request from another release is
refused with 409 before it reads or writes (`index.test.ts`), and a container
refused at restore starts without the record (`test_saved_records.py`). The
store's root check moved from commit to prepare (`storage.test.ts`).
…ncluded

The edge recognizes a previous release's container during a rollout by the
`Leaf-Release` header on its answer (`rollingOut`), but the website adapter
stamped it only on page routes. A container on the previous image asked for a
page only the new release has answered 404 without it, so the edge passed the
404 through for the minutes the rollout ran, where it should have answered
with the published state or a 503 to retry. Codex found this reviewing the
previous commit and reproduced it against the adapter.

`PageEndpoint._delivery_headers` now names the release on every response of
a server that runs one, which only the website adapter does; local servers'
headers don't change. `test_a_website_example_uses_the_real_page_server`
holds the 404 case.
@max-sixty
max-sixty merged commit 5d242ce into main Nov 19, 2026
5 checks passed
@max-sixty
max-sixty deleted the inbox-dot-resolve branch November 19, 2026 02:46
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