Skip to content

Server fails to start while a machine setup is pending: the startup sweep waits 60 s, the launcher's health limit #8199

Description

@lanjak

Summary

If a machine is still in setup when the bb server restarts, the server does not become healthy within the launcher's 60 s limit, so the start fails. A machine provider whose setup is waiting on the user, such as Manual machine setup waiting for its enrollment command, is still pending at the next start, so every restart fails the same way until the record is cleared. Expected: the server starts and listens, and the pending machine setup continues in the background.

Versions and environment

  • Reproduced on main at 9f72ff5aeb with pnpm start:worktree, a fresh data dir, Node 22.19.0, Linux (Fedora 44).
  • First seen while testing a fork prototype for feat: enroll SSH sandboxes without a manual installer #3666, on a dev instance with a Manual machine setup left pending by a page reload: 8 starts in a row failed, and the server was healthy 1 s after that record was cleared.
  • Installed bb on the reporting machine: 0.50.1.

Steps to reproduce

  1. pnpm start:worktree on a fresh checkout of main. It prints the server URL, here http://127.0.0.1:22551.
  2. With the checkout's CLI (pnpm -s bb:dev, BB_SERVER_URL set to that URL), add a direct route so Manual setup does not need a getbb.app sign-in, then create a Manual machine and do not run its enrollment command:
    pnpm -s bb:dev server access add direct http://<lan-ip>:22551
    pnpm -s bb:dev server access order direct
    pnpm -s bb:dev machine create --provider manual --no-wait --json   # lifecycle.phase: "creating"
  3. Stop the instance and run pnpm start:worktree again.

Control: set that host row to phase='destroyed' and start again.

Expected vs actual

With the pending machine (timestamps added):
08:29:14   ○  Starting server
08:30:14   ✗  Server failed to start
08:30:14      Server failed to become healthy: Timed out waiting for health at http://127.0.0.1:22551/health

Control, without it:
08:30:44   ○  Starting server
08:30:45   ✓  Server listening on http://127.0.0.1:22551

Expected: the server listens within a few seconds in both cases.

Evidence

From the code at 9f72ff5. I observed the 60 s failure, not the internal timing:

So the server cannot listen before the launcher gives up. The failed run wrote no server log lines before it was stopped.

The same path applies to any machine provider whose create can take more than about 60 s after a restart, for example an SSH setup that is still installing.

What you ruled out

Suggested priority and effort

High: a single abandoned Manual setup blocks every later start, and the only workaround is editing bb.db. The fix needs one decision: should startup wait for machine provider recovery at all? One option is to run the machine lifecycle step after the listener starts, or not to await creates still in progress during the startup sweep.

AGENT GENERATED

Activity

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

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    • Classification: Bug · Priority High · Effort Medium · host.
    • Report: https://get-bb.github.io/reports/issues/8199.html — REPRODUCED, high root-cause confidence; applied confirmed-repro.
    • Root cause: startup awaits machine recovery before opening HTTP; pending creation consumes the sweep's 60-second detach deadline and misses launcher health readiness. Two clean trusted-main live runs reproduced this with the real Manual provider.
    • Regression: apps/server/test/services/startup-machine-recovery.test.ts fails before the fix and passes afterward; all 49 tests across seven relevant suites, server typechecking, and type-aware lint pass.
    • Ready fix PR: Keep machine recovery off the HTTP readiness path #8200 — 65 changed text lines, two files. Pending-machine restart becomes healthy in 1.37 seconds, with setup continuing in the background. Not merged.

    AGENT GENERATED

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-reprohost

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions