Repository navigation
Install the machine service when a desktop-hosted server moves away - #4175
Merged
SawyerHood merged 1 commit intoSep 23, 2026
Merged
Conversation
After its local server moves, the desktop app used to keep this computer a machine through its own bb-app process: the daemon ran only while the app was open and, bundled with the app, never updated itself, so the first server update after the move took the machine and its threads offline. Now, when the desktop activates a move (live or on a later launch) and no machine service exists for its data directory, it stops its own runtime and runs the bundled `install-machine.sh --adopt` in the background, logging to <data-dir>/logs/install-machine-service.log. If the install fails, for example without Node.js 22.19+, it keeps today's app-owned machine, explains why once per move, and tries again on the next launch. bb-app's moved mode no longer starts a host daemon when a machine service runs the data directory; it only answers the old address with the move notice, so the desktop app and `npx bb-app` never compete with the service for the daemon lock. Without a service, moved mode now points at `bb server install-machine-service`. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
SawyerHood
force-pushed
the
bb/moved-desktop-runtime
branch
from
September 23, 2026 17:10
629b782 to
8d86b5d
Compare
SawyerHood
marked this pull request as ready for review
September 23, 2026 17:37
SawyerHood
added a commit
that referenced
this pull request
Sep 23, 2026
…puter (#4176) ## Human comments ## What was wrong Nothing in the move checklist told someone moving a desktop-hosted server what happens to their computer afterwards, or that keeping it connected needs Node.js 22.19+. Stacked on #4175, which installs the service from the desktop app. ## What changed - `ServerMoveAppOptions` carries the server's `BB_APP_SURFACE`, taken from `serverConfig` in `start-server.ts` and defaulting to `web` in `createApp`. It flows through `createDefaultServerMoveEnvironment` into `ServerMoveEnvironment.serverAppSurface` and the check environment. - When the server runs in the desktop app, `runServerMoveCheck` adds an info item, `desktop-app-machine`. It says the app will keep the computer connected as a background machine that updates with the server, and that this needs Node.js 22.19+ there. It never blocks the move. No server/daemon wire change. ## How you verified - `apps/server/test/server-move/checks.test.ts`: a desktop-hosted server gets the item; a web one doesn't; `canMove` is unchanged. - Test environment builders updated. - `pnpm exec turbo run test --filter=@bb/server -- test/server-move/`: 97 passed. - Full `@bb/server` suite: 3085 passed. - `pnpm exec turbo run typecheck --filter=@bb/server` passes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) > AGENT GENERATED Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
3 tasks done
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
This is the part that fixes the desktop case directly. After its local server moved, the desktop app ran this computer's daemon through its own bb-app process in moved mode. That process was killed when the app quit and restarted on the next launch, and its bundled daemon never updated itself. So the machine was offline whenever the app was closed, and it dropped off entirely after the next protocol bump on the server.
Stacked on #4174, which adds
bb server install-machine-serviceand@bb/config/machine-service.What changed
apps/desktop/src/moved-machine-service.ts,main.ts). When the app activates a move, either live or on a later launch, and no machine service exists for its data directory, it does this in the background:install-machine.sh --adopt, found throughresolveDesktopMachineInstallerPath<data-dir>/logs/install-machine-service.logpackages/bb-app/src/launcher.ts):npx bb-appcompetes with the service for the daemon lockbb server install-machine-servicedocs/server-move-plan.md.No server/daemon wire change.
How you verified
apps/desktop/test/moved-machine-service.test.ts:/bin/shfake installer and checks the arguments, log append, reason from this run's✗line, and fallback exit descriptionapps/desktop/test/app-paths.test.ts: the installer path inside the asar-unpackedbb-apppackage.packages/bb-app/test/moved-mode.test.ts: with a service, moved mode never starts a daemon, keeps the responder, and exits on shutdown.pnpm exec turbo run test --filter=bb-app: 149 passed.preload-build.test.ts, SIGABRT launching Electron) or are flaky under load (electron-builder-config.test.tspasses alone)./install.shfromserver/dist/assets.🤖 Generated with Claude Code