Repository navigation
Description
Summary
install-machine.sh's already-joined fast path never starts a daemon process. When a machine's data dir already holds valid credentials for the target host and server, the script prints "This machine is already joined" and skips straight to the service-install step, without ever setting $join_pid. Under BB_INSTALL_SKIP_SERVICE=1 (the disposable-compute path, no systemd/launchd service to fall back on), the script then exits with no daemon running at all.
Versions and environment
- bb from source at commit
99c0ad71841ff6ff2d42b3f7864b6dba0b0f7337(main) - macOS 25.5.0 (Darwin), arm64, plus a Docker container repro (
node:22-bookworm-slim) - Not an agent/provider issue; this is the enrollment script itself
Steps to reproduce
- Enroll a fresh disposable container against a real server with a normal join code and
BB_INSTALL_SKIP_SERVICE=1. Confirmconnectedviabb machine list. docker kill+docker rmthe container, but keep its volume (so$data_dir/auth.jsonandconfig.jsonsurvive). Host flips todisconnected.- Start a brand-new container with the same volume mounted at the same
$data_dir, same--host-id,BB_INSTALL_SKIP_SERVICE=1, and reruninstall-machine.sh(a stale/reused join code is fine, see step 4). - Watch the output:
This machine is already joined to <server_url> as <host_id>, thenService installation skipped., then exit 0. - Check
bb machine list— the host is stilldisconnected. No daemon process is running anywhere.
Did not reproduce differently when using a fresh join code in step 3; the already-joined short-circuit in auth_matches_host()/the config.json check triggers regardless, because it only inspects the data dir, never the join code.
Code path (current main, apps/server/src/assets/install-machine.sh):
already_joined=no/ already-joined detection, lines 578-595$join_pidis only ever set insideif [ "$already_joined" = no ], lines 597-639BB_INSTALL_SKIP_SERVICEbranch exits without starting anything when$join_pidis unset, lines 643-650
Expected vs actual
Actual: already-joined + BB_INSTALL_SKIP_SERVICE=1 prints Service installation skipped. and exits 0 with no daemon process running. The host stays disconnected indefinitely; nothing else will start the daemon.
Expected: the already-joined path should still get a daemon running under BB_INSTALL_SKIP_SERVICE=1, the same way the non-already-joined path does (host-daemon join, or equivalent, backgrounded with its PID tracked), since there's no service manager to fall back on in that mode.
Confirmed as correct behavior for the actual normal use case this branch is meant for: a real reinstall/upgrade of a machine that already has a persistent systemd/launchd service managing the daemon. It's specifically the BB_INSTALL_SKIP_SERVICE=1 combination that has no daemon anywhere.
Evidence
- Live repro against the local dev server (
scripts/bb-dev-app): first containerhost_j7ar5b3aem,connectedafter joining. After kill+rm (volume kept) and a fresh container reusing the same (already-exhausted) join code,bb machine listshowed the host stuckdisconnected; confirmed no daemon process by directly invokingbb-app host-daemon join --host-daemon-port <port> --host-id host_j7ar5b3aem --server-url <url>afterward, which connected immediately and flipped the host toconnectedwith no duplicate row. - This confirms the join/reconnect mechanism itself is fine (a persisted credential is sufficient to reconnect, keyed on
hostId); the gap is specifically thatinstall-machine.shnever invokes it on this path.
What you ruled out
- Not a server/protocol bug: manually running
bb-app host-daemon joinwith the same credentials connects immediately, no server changes needed. - Not fixed by #2969 (host-only install artifact) or #2972 (drop redundant
launchctl kickstart -k), the two most recent commits touching this script onmain; both touch different regions (package download and the persistent-service launchd path respectively), and the already-joined/BB_INSTALL_SKIP_SERVICEregion (lines 578-650) is byte-identical to before those merged. - Searched open and closed issues for
install-machine.sh,BB_INSTALL_SKIP_SERVICE, and "already joined"; found none covering this.
Suggested priority and effort
Medium — blocks any disposable-container/ephemeral-compute recipe that reuses a volume across container restarts (a very natural pattern for "pause and resume" style workflows), with no workaround short of calling bb-app host-daemon join directly instead of the installer. Effort looks Low: start the daemon in the already_joined branch too, at least when BB_INSTALL_SKIP_SERVICE=1 is set.
AGENT GENERATED
Activity
bb-slop-cop commentedon Sep 3, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotdesktop,host,confirmed-repromainbecause the daemon PID file did not exist.Start an enrolled daemon when service setup is skipped (get-bb#3000)