Repository navigation
Conversation
The Cloudflare Worker combines the SvelteKit output with the Workflow entrypoints, and both import the bundled runtime release. Vite inlined one copy and Wrangler added a second from source. Leaving the release external in the SvelteKit build lets Wrangler resolve both imports to the same module, which removes about 9 MB from the Worker.
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
widefleet-docs | 183c1d8 | Nov 21 2026, 01:28 PM |
tnkuehne
added a commit
that referenced
this pull request
Nov 21, 2026
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. <!-- greptile_comment --> <!-- greptile_summary --> <h2><a href="https://app.greptile.com/api/retrigger?id=115293433&sig=7eb31f5f8103464b9c2cd3f1239127c85ab67f3df8366d031a4c17ddf6e8d153"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/RetriggerDark.svg?v=2"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"><img alt="Retrigger" src="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2" align="right"></picture></a><a href="https://app.greptile.com/-/switch-tenant?tenant=mendra&next=%2Fwidefleet%2Fwidefleet%2Fpull%2F274&utm_source=greptile_review&utm_medium=github&utm_campaign=view_in_greptile"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptileDark.svg?v=2"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"><img alt="View in Greptile" src="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2" align="right"></picture></a>Confidence Score: 5/5</h2> <!-- greptile-impact-verdict --> The PR appears safe to merge; no actionable issues were found. <details open><summary><h3>Summary</h3></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. </details> <details open><summary><h3>Diagram</h3></summary> ```mermaid %%{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"] ``` </details> <!-- greptile_confidence_score:5 --> <sub>Reviews (1) · Last reviewed commit: ["Serve every organization from the Cloudf..."](34ceb9d) · [Reviewed by Greptile](https://www.greptile.com/?utm_source=greptile_review&utm_medium=github&utm_campaign=review_public&utm_content=widefleet/widefleet)</sub> <!-- /greptile_comment -->
Contributor
Author
|
Superseded by #274, which removes the bundled release from the Cloudflare Worker entirely. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Cloudflare Worker contained the runtime release twice. The SvelteKit build inlined it for the server routes, and Wrangler bundled it again for the Workflow entrypoints that
tools/cloudflare-entry.tsadds from source.The Cloudflare build now leaves
@platform/app-runtime/releaseexternal, so Wrangler resolves both dynamic imports to one module. The Node build is unchanged.Measured with
pnpm build:cloudflareandwrangler deploy --dry-run:worker.jsThe bundle source map lists
packages/app-runtime/dist/release.jsononce, and both imports call the same module initializer.

Confidence Score: 5/5
The PR appears safe to merge; no actionable issues were found.Summary
Leaves
@platform/app-runtime/releaseexternal during the Cloudflare Vite build so Wrangler can bundle one shared copy.Diagram
%%{init: {'theme': 'neutral'}}%% flowchart LR A[SvelteKit server output] --> C[Wrangler bundle] B[Workflow source] --> C C --> D[One shared release module]Reviews (1) · Last reviewed commit: "Bundle the runtime release once in the C..." · Reviewed by Greptile