Skip to content

Serve every organization from the Cloudflare installation runtime - #274

Merged
tnkuehne merged 1 commit into
mainfrom
runtime/installation-runtime-on-cloudflare
Nov 21, 2026
Merged

tnkuehne merged 1 commit into
mainfrom
runtime/installation-runtime-on-cloudflare

Conversation

@tnkuehne

@tnkuehne tnkuehne commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

A Cloudflare installation runs one runtime Worker for all of its organizations. App operations nevertheless recorded an organization-level runtime: an organization without one received the release bundled with the control plane at its first operation, and installation runtime updates never changed it afterwards. The recorded value did not affect which code served the app, because activation already checks the version the runtime Worker reports. To support that path, the Cloudflare Worker bundled the full runtime release — twice, because the SvelteKit output and the Workflow entrypoints each included a copy.

Changes:

  • Cloudflare app operations record the installation organization's applied runtime for every organization. Until a deployment has installed the installation runtime, they fail with a conflict instead of installing a bundled release.
  • Bundled release only in the Node distribution. ensureOrganizationRuntime takes the bundled release as a parameter. runtime-node.ts passes loadBundledRuntime; the Cloudflare composition does not. Agent job claims were already rejected for Cloudflare execution, so no Worker code path imports the release any more.
  • Migration 0036 clears runtime and applied_runtime for Cloudflare organizations other than the installation organization. Agent-backed organizations and the installation organization keep their selections.
  • docs/architecture.md records the difference between agent-backed and Cloudflare runtime selection.

Agent-backed installations are unchanged: each organization keeps its own selection, the first app job installs the bundled release, and widefleet runtime update stays the explicit upgrade path.

Cloudflare Worker size, measured with pnpm build:cloudflare and wrangler deploy --dry-run:

worker.js gzip
Before 30,779 KiB 5,493 KiB
After 12,984 KiB 2,197 KiB

This supersedes #262, which removed only the duplicate copy.

Validation:

  • Type checks, lint and format pass.
  • RUN_CLOUDFLARE_TESTS=1 vitest run apps/control-plane/tests/cloudflare: 253 of 253 pass. The workerd tests now record the installation runtime in their setup, as a Hosted deployment does.
  • The default suite passes except runtime-errors.integration.test.ts, which fails identically on main locally without a built Node server.
  • New tests: operations for another organization target the installation runtime and leave that organization's selection empty; operations fail before the installation runtime exists; ensureOrganizationRuntime without a bundled release requires an explicit installation; the migration clears only Cloudflare organizations other than the installation.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no actionable issues were found.

Summary

Cloudflare app operations now record the installation’s applied runtime instead of selecting a separate release for each organization.

  • Cloudflare app operations use the installation’s applied runtime.
  • Node still loads its bundled runtime, while Cloudflare does not bundle it.

No actionable issues were found.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    Node["Node composition"] --> Bundle["Bundled release loader"]
    Bundle --> Agent["First agent app job"]
    Hosted["Hosted deployment"] --> Installation["Installation applied runtime"]
    Installation --> Cloudflare["Cloudflare app operations for every organization"]
    Cloudflare --> Ready["Activation checks the serving Worker's release"]
Loading

Reviews (1) · Last reviewed commit: "Serve every organization from the Cloudf..." · Reviewed by Greptile

A Cloudflare installation runs one runtime Worker for all organizations,
but app operations recorded an organization-level runtime. An
organization without one received the release bundled with the control
plane at its first operation, and later installation runtime updates
never changed it. The Worker also had to bundle the full runtime release
for that path.

Cloudflare app operations now record the installation organization's
applied runtime and fail until a deployment has installed it. Only the
Node distribution passes its bundled release to the agent job service,
so the Cloudflare Worker no longer contains a runtime release. A
migration clears the unused organization-level selections on Cloudflare;
agent-backed organizations keep their own runtime.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
widefleet-docs 34ceb9d Nov 21 2026, 06:53 PM

@tnkuehne
tnkuehne merged commit 5080c3a into main Nov 21, 2026
17 checks passed
@tnkuehne
tnkuehne deleted the runtime/installation-runtime-on-cloudflare branch November 21, 2026 23:55
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