CloudflareContainerBackend: pass image, instance and containerSnapshot to ctx.container.start() for the durable_object scheduling policy

Geschlossen
#176 0 Kommentare 1 Reaktion 1 zugewiesene Person Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

@aron-cf arbeitet bereits daran.

Seit 30.9.2026.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Beschreibung

CloudflareContainerBackend cannot start a container on an app that uses the new durable_object scheduling policy, because it never passes an image to ctx.container.start().

What happens today (main at ada64809, 2026-09-29; @cloudflare/computer 0.3.0)

  • ContainerLaunchSpec is { env, enableInternet }, and the host launches with ctx.container.start({ enableInternet, env }).
  • Under durable_object, monitor() rejects a start that names neither image nor containerSnapshot (scheduling policy).
  • With no instance, the container gets lite (1/16 vCPU, 256 MiB), which is too small for computerd plus a build toolchain.
  • #launchAs is private, so a Durable Object using withWorkspaceContainer cannot add these fields itself without replacing ctx.container.

What would fix it

  1. Optional image, instance and containerSnapshot on CloudflareContainerBackendOptions. Each would be a value or a function the backend calls at every launch, so the Durable Object can choose them per task.
  2. Carry the three through ContainerLaunchSpec, and include them in the launch record, so a running container started with a different spec is relaunched, as env and enableInternet already are.
  3. A snapshot(options) method on the host API that passes through to ctx.container.snapshotContainer(). A workspace could then save the container's own disk (tool caches) before setInactivityTimeout lets it sleep. /workspace is a mount, so a snapshot leaves it out, and it stays with the Workspace as now.

Why it matters to us

We run CloudflareContainerBackend inside our own Durable Object through withWorkspaceContainer. Moving to the new policy would give us:

  • the faster start path from the 2026-09-30 post;
  • an instance size chosen per task;
  • no app-wide rollout that replaces containers while a build is running.
Vorherrschende Sprache
TypeScript
Sterne
9.7k
Forks
577
Ø Merge
1 T. 15 Std.
Gemergte PRs (30 T.)
79

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus cloudflare/computer

Alle Issues in cloudflare/computer

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.