Skip to content

feat(cloudflare)!: Durable Object-managed Containers - #684

Closed
Butch78 wants to merge 2 commits into
alchemy-run:mainfrom
Butch78:feat/cloudflare-do-containers
Closed

Butch78 wants to merge 2 commits into
alchemy-run:mainfrom
Butch78:feat/cloudflare-do-containers

Conversation

@Butch78

@Butch78 Butch78 commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

Model Cloudflare's Durable Object-managed Containers (scheduling_policy: "durable_object", public beta), where a container's images move from the application to the Worker upload and the Durable Object picks one at runtime. None of it is in the API reference yet, so the shapes are transcribed from wrangler 4.144.0 (deploy-helpers container-metadata.ts and durable-object-container-applications.ts).

// workers / workers_for_platforms: every metadata.containers entry (script upload + beta versions)
{ className: "Sandbox", name: "sandbox", images: { node: "registry.cloudflare.com/<acct>/node@sha256:…" } }

// containers: new operation, polled until "ready" before an image may be uploaded
yield* Containers.prepareContainerImage({ accountId, image }) // { status: "pending" | "ready" | "error", reason? }

// containers: a DO-managed application has no image, instances or configuration
yield* Containers.createContainerApplication({
  accountId, name, schedulingPolicy: "durable_object",
  durableObjects: { namespaceId }, observability: { logs: { enabled: true } },
})
  • Breaking: ContainerConfiguration.image, CreateContainerApplicationRequest.maxInstances / .configuration, and ContainerApplicationItem.instances / .maxInstances / .configuration are now optional.
  • configuration gains experimentalFlags, wranglerSsh and authorizedKeys. Create, update and the item gain top-level observability.
  • fix(core): mapKeys no longer renames keys that an index signature admits. They are map data, and before this fix an image named className went on the wire as class_name.

These shapes were exercised live through alchemy's Durable Object-managed container support: image preparation, the upload's containers[].images, and creating the image-less application. A Durable Object started each named image by ctx.container.images.

🤖 Generated with Claude Code

Matthew Aylward and others added 2 commits September 30, 2026 16:21
A KeyDictionary renames member names the schema cannot see, but mapKeys
also applied it to keys an index signature admits. Those are data: a
Worker upload's `metadata.containers[].images` maps user-chosen image
names to registry references, and an image named `className` went out
as `class_name`. Keys matched by an index signature now pass through
verbatim in both directions; opaque objects still rename.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Cloudflare's `scheduling_policy: "durable_object"` (public beta) moves a
container's images from the application to the Worker upload, so the
Durable Object picks one at runtime through `ctx.container.images`.
None of it is in the API reference yet; shapes are transcribed from
wrangler 4.144.0.

- workers / workers_for_platforms: each `metadata.containers` entry
  (script upload and the beta versions API) gains `name` and `images`,
  a map of image name to prepared registry reference.
- containers: new `prepareContainerImage`
  (POST /accounts/{account_id}/containers/image-preparations), polled
  until `ready` before an image may be referenced from an upload.
- containers: a DO-managed application is created with only
  `{ name, scheduling_policy, durable_objects, configuration?,
  observability? }`, so `maxInstances`, `configuration` and
  `configuration.image` become optional on create, and the application
  item's `instances`, `maxInstances` and `configuration` become
  optional. `configuration` gains `experimentalFlags`, `wranglerSsh`
  and `authorizedKeys`; create, update and the item gain top-level
  `observability`.

BREAKING CHANGE: `ContainerConfiguration.image`,
`CreateContainerApplicationRequest.maxInstances` / `.configuration` and
`ContainerApplicationItem.instances` / `.maxInstances` /
`.configuration` are now optional.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Butch78

Butch78 commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

Closing: this was the distilled half of alchemy-run/alchemy#1904, which is closed in favour of alchemy-run/alchemy#1905. Its distilled counterpart is #685.

@Butch78 Butch78 closed this Oct 3, 2026
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.

1 participant