Skip to content

Enrolled machine launcher overrides managed terminal CLI routing and returns 401 #8264

Description

@OXI-717

Observed behavior

In a BB-managed terminal on an enrolled macOS machine (BB 0.50.1), the standalone bb command from the machine installer returns HTTP 401 for a read-only thread lookup. The same terminal and arguments succeed when invoking the executable named by BB_CLI directly. The terminal has a loopback BB_SERVER_URL supplied by the host daemon.

Reproduction

  1. Enroll a macOS execution machine with the standard machine installer and open a thread-scoped terminal on it.
  2. Make sure plain bb resolves to the machine installer's shell launcher. Run bb thread show "$BB_THREAD_ID" --json.
  3. Run "$BB_CLI" thread show "$BB_THREAD_ID" --json in the same terminal.

The first command should use the same scoped server connection as the second.

Diagnosis

I compared the managed terminal environment with what the npm launcher forwards to the BB_CLI override, recording only equality and presence flags. The launcher changed BB_SERVER_URL and populated BB_SERVER_HEADERS; the daemon port remained unchanged. Invoking the supplied CLI directly also succeeded with the recursion marker set.

packages/bb-app/src/launcher.ts resolves the managed config before runBundledCliCommand() delegates to BB_CLI. In that path, resolveServerUrl() prefers the configured server URL over the inherited one, and applyManagedConfigEnv() injects the configured headers. Test an enrolled-machine launcher with a stored server URL and a managed terminal using a different loopback proxy. Standalone calls without managed context should continue to use the installed machine configuration.

Activity

  1. added theissue type on Nov 26, 2026
  2. added
    remote
    cli
    confirmed-repro
    on Nov 26, 2026
  3. bb-slop-cop commented on Nov 26, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    • Classification: Bug · Priority Medium · Effort Low · remote, cli.
    • Report: Reproduction and root-cause report.
    • Verdict: REPRODUCED · high root-cause confidence · confirmed-repro.
    • Root cause: The npm launcher resolves installed configuration before delegating to BB_CLI, replacing the supplied loopback authentication-proxy URL. The real CLI then contacts upstream without the machine header that the proxy supplies; injected environment headers do not repair that request path.
    • Verification: Two clean checkouts of trusted main at b0ddaad731 reproduce direct CLI exit 0 versus launcher HTTP 401, including with the recursion marker. Both new managed-context cases fail as expected; the second run also passes all 79 existing launcher tests and the standalone control. The complete regression test is embedded in the report. Native macOS enrollment was not exercised.
    • No PR: Repair changes routing/authentication-context precedence, which this rule explicitly excludes from automatic simple fixes.
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

    cliconfirmed-reproremote

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions