Skip to content

install-machine.sh's already-joined path never starts a daemon under BB_INSTALL_SKIP_SERVICE=1 #2997

Closed

Description

@technicalpickles

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

  1. Enroll a fresh disposable container against a real server with a normal join code and BB_INSTALL_SKIP_SERVICE=1. Confirm connected via bb machine list.
  2. docker kill + docker rm the container, but keep its volume (so $data_dir/auth.json and config.json survive). Host flips to disconnected.
  3. Start a brand-new container with the same volume mounted at the same $data_dir, same --host-id, BB_INSTALL_SKIP_SERVICE=1, and rerun install-machine.sh (a stale/reused join code is fine, see step 4).
  4. Watch the output: This machine is already joined to <server_url> as <host_id>, then Service installation skipped., then exit 0.
  5. Check bb machine list — the host is still disconnected. 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):

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 container host_j7ar5b3aem, connected after joining. After kill+rm (volume kept) and a fresh container reusing the same (already-exhausted) join code, bb machine list showed the host stuck disconnected; confirmed no daemon process by directly invoking bb-app host-daemon join --host-daemon-port <port> --host-id host_j7ar5b3aem --server-url <url> afterward, which connected immediately and flipped the host to connected with 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 that install-machine.sh never invokes it on this path.

What you ruled out

  • Not a server/protocol bug: manually running bb-app host-daemon join with 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 on main; both touch different regions (package download and the persistent-service launchd path respectively), and the already-joined/BB_INSTALL_SKIP_SERVICE region (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

  1. added theissue type on Sep 3, 2026
  2. added
    desktop
    host
    confirmed-repro
    on Sep 3, 2026
  3. bb-slop-cop commented on Sep 3, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-reprodesktophost

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions