Repository navigation
Initialize Hosted installations within the deployment process - #264
Merged
Merged
Conversation
A Hosted deployment opened two remote Wrangler sessions: one to verify the active Runtime version, and one in a separate initialization process that published sign-in settings. The initialization process also migrated the database again. The initialization steps now live in a shared function. The deployment calls it in-process with the session it opened for the Runtime check, after its own migration. The initialize:cloudflare command keeps its behavior: it migrates, initializes and opens its own session only when it publishes settings.
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
widefleet-docs | f4b441f | Nov 21 2026, 01:39 PM |
tnkuehne
added a commit
that referenced
this pull request
Nov 22, 2026
) #264 changed `connectCloudflareSettings` to take existing platform bindings, so the deployment can share one session. Operator commands that run on their own have no session to pass and relied on the helper opening one from a Wrangler configuration. - `connectCloudflareSettings` opens a session from `configPath` again and returns `close`, as before #264. - `createCloudflareSettings` takes existing bindings; Hosted initialization uses it with the shared deployment session. <!-- greptile_comment --> <!-- greptile_summary --> <h2><a href="https://app.greptile.com/api/retrigger?id=115439918&sig=84dce517bed30b1fa52ecdd30ce53a2f37b6749679def608de5d5419decb8b24"><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%2F278&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 --> This PR appears safe to merge; standalone and shared sessions have separate, clear owners. <details open><summary><h3>Summary</h3></summary> Restores `connectCloudflareSettings` as an async helper that opens a Wrangler session and returns `close`. - Standalone operator commands open a Cloudflare session from their Wrangler config. </details> <details open><summary><h3>Diagram</h3></summary> ```mermaid %%{init: {'theme': 'neutral'}}%% flowchart TD A[Standalone caller] --> B[connectCloudflareSettings] B --> C[Open Wrangler session] C --> D[createCloudflareSettings] D --> E[Return services and close] E --> F[Caller closes session] G[Hosted deployment] --> H[Open shared Wrangler session] H --> I[Check runtime and initialize installation] I --> D I --> J[Deployment finally closes shared session] ``` </details> <!-- greptile_confidence_score:5 --> <sub>Reviews (1) · Last reviewed commit: ["Let standalone operator commands open th..."](e62c14b) · [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 -->
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.
A Hosted deployment (
tools/deploy-hosted.ts) opened two remote Wrangler sessions throughgetPlatformProxy:tools/initialize-cloudflare.ts, which ran as a separate Node process, to publish sign-in settingsThe separate process also migrated the database a second time and loaded the control-plane modules again.
Changes:
tools/cloudflare-initialization.tsholds the initialization steps that previously lived in the script. The caller provides a migrated database and the platform bindings.tools/deploy-hosted.tsopens the remote session once, uses it for the Runtime check and the initialization, and disposes of it at the end. Initialization runs in-process with the same configuration the child process received. Its errors are printed through the existing redaction before the tool exits.tools/initialize-cloudflare.ts(pnpm initialize:cloudflare) keeps its behavior: it migrates, initializes, and opens a session only when it publishes settings.connectCloudflareSettingstakes the platform bindings instead of opening its own session.Validation: type checks, lint and format pass.
RUN_CLOUDFLARE_TESTS=1 vitest run tests/cloudflare/initialization.test.ts tests/cloudflare/hosted-installation.test.tspasses 24 of 24 tests, including initialization against workerd bindings. The deployment tool itself needs a Cloudflare account and was not run.

Confidence Score: 5/5
The PR appears safe to merge; the previous cleanup finding is fixed.Summary
Hosted deployments now initialize the installation in-process and share one Wrangler session with the Runtime check.
Reviews (2) · Last reviewed commit: "Clean up after a failed platform session..." · Reviewed by Greptile