Repository navigation
Let the connect gate serve the Windows machine installer - #4734
Merged
Merged
Conversation
SawyerHood
marked this pull request as ready for review
October 2, 2026 16:50
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
The gate forwards a fixed list of installer paths without a session so a new machine can fetch them. /install.ps1, the PowerShell counterpart of /install.sh, joins that list. Co-Authored-By: Claude Code <[email protected]>
SawyerHood
force-pushed
the
bb/windows-connect-installer-path-thr_jensq3v9th
branch
from
October 2, 2026 17:29
ef5cc06 to
9a694de
Compare
SawyerHood
deleted the
bb/windows-connect-installer-path-thr_jensq3v9th
branch
October 2, 2026 17:56
SawyerHood
added a commit
that referenced
this pull request
Oct 2, 2026
## Human comments ## What was wrong Adding a machine produced only `curl … /install.sh | sh`, and `install-machine.sh` stops on anything but macOS and Linux, so a Windows computer could not join another bb server. Two things would also have broken an enrolled Windows daemon: the host package the server builds for machines left out `bb.cmd`, so `bb` did not resolve in that machine's terminals and agent shells, and the daemon's protocol self-update ran `npm` by bare name, which Windows cannot start. Part of #1206. ## What changed - **Installer.** New `apps/server/src/assets/install-machine-windows.mjs`, a Node script with no dependencies. It reads the same enrollment bundle as the shell installer, installs the server's host package into `%USERPROFILE%\.bb-machines\<server-host>\npm` (SHA-256 checked, conditional request on later runs, npm registry fallback on 404), verifies the native modules load, runs `bb machine enroll`, joins, and starts the supervised daemon. It registers the daemon in the user's `Run` registry key so it starts at sign-in, and `--start`, `--stop`, and `--uninstall --host-id <id>` manage it from the copy it leaves in the machine directory. - **Starting the daemon.** The daemon is created through WMI (`Win32_Process.Create`, hidden window) and not as a child of the installer. A child process would die with the installing SSH session, and would hold the installer's output pipe open so a captured install never returns. - **Server.** `GET /install.ps1` returns a PowerShell script that writes the installer to a temp file and runs it with the bundle in an environment variable. An unusable enrollment returns a script that throws the reason with status 200, because `irm | iex` discards the body of an error response. `manualEnrollmentPowerShellCommand` builds `irm -Headers @{…} '<server>/install.ps1' | iex`. - **Contract.** The enrollment-command and reconnect responses gain `windowsCommand`. The plugin SDK surface check reports no change. - **UI and CLI.** The command box in Add machine and Reconnect has a "macOS or Linux" / "Windows" toggle; `bb machine create --provider manual` prints both commands. - **Host package and self-update.** The host package the server builds for machines lists `win32` in its `os` field whatever `bb-app` itself lists, so npm accepts it on Windows; `bb.cmd` ships in it, and the protocol self-update runs npm through the portable launcher on Windows. The installer removes the retired package directories npm leaves behind when it replaces a running package. - Docs: `bb guide machines`, `docs/multiple-devices.md`. The daemon runs in the signed-in user's session from the `Run` key, not as a Windows service, so it stops when the user signs out. Enrollment through bb connect also needs the gate to forward `/install.ps1` (#4734). ## How you verified - Windows 11 Enterprise VM (build 26300), against a bb server running on the same VM with direct machine access, on a branch combining this with the other open Windows changes: - `bb machine create --provider manual`, then the returned PowerShell command run with its output captured: the installer downloaded and installed the host package, enrolled, started the daemon, and exited 0; `bb machine list` showed the second machine connected, and it stayed connected after the installing SSH session ended. - A terminal created on the enrolled machine ran `bb status` and exited 0. - `--stop` left no daemon processes and the machine disconnected; `--start` reconnected it in 2 seconds; `--uninstall` removed the machine directory and the `Run` entry. - Self-update: with the server rebuilt one protocol version ahead and restarted, the enrolled daemon logged "Installed the server-matched bb host package; restarting the daemon", exited 75, was restarted by its supervisor, and reported the new protocol version within 15 seconds. - Linux: new tests for the PowerShell command, the wrapper script (literal here-string, quoted bundle, refusal of a script that would end the here-string), the installer's argument, bundle, startup-command, and service-name logic, the `/install.ps1` responses, the host package contents, and the dialog toggle. On this branch before the last rebase, `turbo run lint typecheck test --filter='...[origin/main]'`: 184 of 186 tasks passed. The failing tasks were the app and server test tasks, with tests that time out when the development machine is loaded (`PromptBoxInternal.test.tsx`, `PluginSettings.test.tsx`, `machine-environment.test.ts`, `plugin-native-server-loading.test.ts`) and pass when run alone. Both plugin SDK version checks pass. After the rebase onto current main, lint and typecheck pass for the same filter. Not verified: a non-administrator Windows account (the VM user is an administrator); starting at sign-in from the `Run` key (the entry was checked, sign-in was not exercised); enrollment through bb connect; PowerShell 7 (the VM has Windows PowerShell 5.1). 🤖 Generated with [Claude Code](https://claude.com/claude-code) > AGENT GENERATED Co-authored-by: Claude Code <[email protected]>
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.
Human comments
What was wrong
The connect gate forwards a fixed list of installer paths to a server without a session, so a machine being added can fetch them:
/install.sh,/install/version, and/install/bb-app.tgz. The Windows machine installer added in #4735 is served at/install.ps1, which the gate does not forward without a session. Part of #1206.What changed
apps/connect/src/worker.ts:/install.ps1joins the public installer path list. Like the others it is GET only, is refused for a machine target, and has the cloud-dev header stripped.This deploys with the gate. It has no effect until a server serves the path.
How you verified
/install.ps1. On this branch before the last rebase,turbo run lint typecheck test --filter='...[origin/main]': 14 of 14 tasks passed. After the rebase onto current main, lint and typecheck pass for the same filter.Not verified: not deployed or exercised on staging. The Windows enrollment was tested against a server reached directly, not through the gate.
🤖 Generated with Claude Code