Repository navigation
Enroll a Windows machine with another bb server - #4735
Conversation
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c2cec11362
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| async function installPackage({ dataDir, npmPrefix, source }) { | ||
| const launch = npmLaunch([ | ||
| "install", |
There was a problem hiding this comment.
Allow the generated host package to install on win32
On a normal Windows installation, this npm install rejects the downloaded artifact with EBADPLATFORM before enrollment can run. Both artifact builders preserve packages/bb-app/package.json's os: ["darwin", "linux"] in the generated host package (packages/bb-app/scripts/build-host.mjs and apps/server/src/services/install/bb-app-artifact.ts); npm's bundled package-json documentation confirms that os specifies the permitted operating systems and uses process.platform. Generate the host-only package with win32 permitted rather than inheriting the desktop package restriction.
Useful? React with 👍 / 👎.
Adding a machine produced only a curl-and-sh command, so a Windows computer could not join another server. The server now also returns a PowerShell command that fetches /install.ps1, which writes and runs a Node installer: it installs the server's host package under the machine directory, enrolls, starts the daemon without a window through WMI so it outlives the installing session, and registers it in the user's Run key. The same installer stops, starts, and removes the machine. The Add machine and Reconnect dialogs offer the Windows command, and the CLI prints both. The host package now ships bb.cmd, and the daemon's protocol self-update runs npm through the portable launcher, so an enrolled Windows daemon follows its server's version. Co-Authored-By: Claude Code <[email protected]>
c2cec11 to
86d4f5b
Compare
## 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.ps1` joins 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 - Linux: the existing gate test that forwards each installer path without session or machine auth now also covers `/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](https://claude.com/claude-code) > AGENT GENERATED Co-authored-by: Claude Code <[email protected]>
## Human comments ## What was wrong `npm` refused `bb-app` on Windows with EBADPLATFORM because the package's `os` list named only macOS and Linux, and the README and platform docs said native Windows was not supported. The tarball smoke that guards the npm path could not run on Windows: it spawned `npm`, `npx`, and the installed bin links by bare name, and stopped only the direct child. Part of #1206. Stacked on #4735, whose behavior the platform doc describes. ## What changed - `packages/bb-app/package.json`: `os` includes `win32`. - `packages/bb-app/scripts/smoke-tarball.mjs` and `managed-process.mjs`: on Windows the smoke runs npm and npx through Node, runs each installed command through the `.cmd` shim npm creates, stops process trees with `taskkill` (bounded to 2 seconds, then the direct kill), and retries removing its temp directory. macOS and Linux behavior is unchanged. - `.github/workflows/ci.yml`: the Windows app smoke job also runs `smoke:tarball`. - Docs: the README, `packages/bb-app/README.md`, `docs/platform-support.md`, and `docs/windows-ci.md` describe native Windows as an alpha host beside WSL2 (Git for Windows required, drive-letter paths, PowerShell terminals, the Windows machine command, no server move to Windows). ## How you verified - Windows 11 Enterprise VM (build 26300): `node scripts/smoke-tarball.mjs` passed in about a minute: `npm pack`, `npx --package <tarball> bb-app --help`, `npm install` of the tarball, the help and config commands through the `.cmd` shims, the provider bridge and plugin host worker bundles, the full stack, and a joined daemon. Before the `os` change npm refused the tarball. - Linux: `smoke:tarball` passes; the bb-app package tests pass with the updated `os` assertion. 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`, `machine-environment.test.ts`, `plugin-native-server-loading.test.ts`) and pass when run alone. After the rebase onto current main, lint and typecheck pass for the same filter. Not verified: `npx bb-app@latest` from the public registry (nothing is published with this change yet); the new CI step has not run. 🤖 Generated with [Claude Code](https://claude.com/claude-code) > AGENT GENERATED Co-authored-by: Claude Code <[email protected]>
Human comments
What was wrong
Adding a machine produced only
curl … /install.sh | sh, andinstall-machine.shstops 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 outbb.cmd, sobbdid not resolve in that machine's terminals and agent shells, and the daemon's protocol self-update rannpmby bare name, which Windows cannot start. Part of #1206.What changed
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, runsbb machine enroll, joins, and starts the supervised daemon. It registers the daemon in the user'sRunregistry 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.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.GET /install.ps1returns 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, becauseirm | iexdiscards the body of an error response.manualEnrollmentPowerShellCommandbuildsirm -Headers @{…} '<server>/install.ps1' | iex.windowsCommand. The plugin SDK surface check reports no change.bb machine create --provider manualprints both commands.win32in itsosfield whateverbb-appitself lists, so npm accepts it on Windows;bb.cmdships 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.bb guide machines,docs/multiple-devices.md.The daemon runs in the signed-in user's session from the
Runkey, 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
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 listshowed the second machine connected, and it stayed connected after the installing SSH session ended.bb statusand exited 0.--stopleft no daemon processes and the machine disconnected;--startreconnected it in 2 seconds;--uninstallremoved the machine directory and theRunentry./install.ps1responses, 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
Runkey (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