Skip to content

Host remains connected but provider workers fail after Homebrew replaces Node #5295

Closed

Description

@ariofrio

Summary

Homebrew replaced Node while BB was running. The enrolled Mac mini stayed connected, but Codex and Claude Code model discovery failed because BB tried to spawn the removed executable. Restarting the complete BB service restored both providers.

Versions and environment

  • BB: 0.45.0 (latest release when investigated), installed through install-machine.sh on a remote enrolled machine.
  • OS/runtime: macOS 26.7.1 (25G241), arm64; Homebrew node@24, Node 24.21.0. Package revision changed from _1 to _2.
  • Providers: Codex 0.162.0, Claude Code 2.1.293 (versions collected after recovery).
  • Service executable: /opt/homebrew/opt/node@24/bin/node — already a stable alias. Daily Homebrew autoupdate upgrades formulae.

Steps to reproduce

  1. Run an enrolled BB machine through Homebrew's stable Node alias.

  2. Leave BB running while Homebrew upgrades Node and removes the previous Cellar executable.

  3. Query both model catalogs, replacing the example host ID:

    bb provider models codex --machine host_inp9jikk4s --json
    bb provider models claude-code --machine host_inp9jikk4s --json
  4. Restart the complete BB service and repeat: both catalogs load again.

Safe mechanism reproduction: save the folded script below as node-runtime-path-repro.mjs in a writable scratch directory and run node node-runtime-path-repro.mjs. It retargets a symlink between byte-identical Node copies and removes only its own old copy. Passed on the mini's Node 24.21.0 and standalone Node 22.23.2; this is a spawn/fork fixture, not a full BB integration test.

Self-contained reproduction script
import assert from 'node:assert/strict';
import { fork, spawnSync } from 'node:child_process';
import { constants, copyFileSync, existsSync, mkdirSync, mkdtempSync, realpathSync, rmSync, symlinkSync, unlinkSync } from 'node:fs';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';

const self = fileURLToPath(import.meta.url);

function forkResult(execPath) {
  return new Promise((resolve) => {
    const options = { silent: true, ...(execPath === undefined ? {} : { execPath }) };
    const child = fork(self, ['worker'], options);
    let message;
    child.on('message', (value) => { message = value; });
    child.once('error', (error) => resolve(error.code));
    child.once('exit', (code) => resolve(code === 0 && message === 'worker started' ? 'ok' : `exit ${code}`));
  });
}

if (process.argv[2] === 'worker') {
  process.send('worker started');
  process.disconnect();
} else if (process.argv[2] === 'parent') {
  const [stable, replacement] = process.argv.slice(3);
  const childArgs = ['-p', 'JSON.stringify({version:process.version,abi:process.versions.modules,arch:process.arch})'];
  const baseline = spawnSync(process.execPath, childArgs, { encoding: 'utf8' });
  assert.equal(baseline.status, 0);
  console.log(`baseline: ${baseline.stdout.trim()}`);
  console.log(`original invocation retained stable alias: ${process.argv0 === stable}`);
  const descendantAlias = spawnSync(process.execPath, ['-p', 'process.argv0'], { encoding: 'utf8' });
  assert.equal(descendantAlias.stdout.trim(), process.execPath);
  console.log('launching a child via process.execPath loses the stable alias');
  unlinkSync(stable);
  symlinkSync(replacement, stable);
  unlinkSync(process.execPath);
  const stale = spawnSync(process.execPath, childArgs, { encoding: 'utf8' });
  assert.equal(stale.error?.code, 'ENOENT');
  console.log(`saved executable after removal: ${stale.error.code}`);
  const recovered = spawnSync(stable, childArgs, { encoding: 'utf8' });
  assert.equal(recovered.status, 0);
  assert.equal(recovered.stdout, baseline.stdout);
  console.log(`stable executable: ${recovered.stdout.trim()}`);
  assert.equal(await forkResult(), 'ENOENT');
  assert.equal(await forkResult(stable), 'ok');
  console.log('fork() default: ENOENT; fork() with stable execPath: ok');
  console.log('PASS: the parent survives; identical replacement restores child launches');
} else {
  const root = mkdtempSync(join(dirname(self), 'node-runtime-fixture-'));
  const original = join(root, 'original/bin/node');
  const replacement = join(root, 'replacement/bin/node');
  const stable = join(root, 'stable-node');
  try {
    for (const target of [original, replacement]) {
      mkdirSync(dirname(target), { recursive: true });
      copyFileSync(process.execPath, target, constants.COPYFILE_FICLONE);
      const sourceLib = join(dirname(process.execPath), '../lib');
      if (existsSync(sourceLib)) symlinkSync(realpathSync(sourceLib), join(dirname(target), '../lib'), 'dir');
    }
    symlinkSync(original, stable);
    const result = spawnSync(stable, [self, 'parent', stable, replacement], { stdio: 'inherit', timeout: 15000 });
    if (result.error) throw result.error;
    assert.equal(result.status, 0);
  } finally {
    rmSync(root, { recursive: true, force: true });
  }
}

Expected vs actual

Expected: new provider workers use an available compatible runtime after replacement, or BB reports a specific runtime recovery action.

Actual: host remains connected; Codex returns:

Could not load models for codex (missing_executable)
  Provider "codex" failed to start: spawn /opt/homebrew/Cellar/node@24/24.21.0_1/bin/node ENOENT
[]

Claude Code fails on the same path. No provider reinstall or authentication change was needed to recover.

Evidence

  • Release runtime.ts:318 captures process.execPath; provider-registry.ts:35 uses it as the worker command. Node resolves symlinks in execPath, so the stable alias becomes a removable Cellar path. The installed bundle contains these expressions.
  • The fixture confirms: old execPath → ENOENT; stable alias → success; default fork() → ENOENT; explicit stable execPath → success. Intermediate launches through execPath also lose the stable alias.
  • The supervisor and plugin-worker launches need auditing; additional plugin failures were not observed.
  • Live failure verified on release 129f621; main 9a47d42 retains the expression, but full BB integration was not rerun on main. Investigation: @thread:thr_z9zqs4r64h; machine host_inp9jikk4s.

Solution comparison

Option Assessment
Preserve stable runtime reference; validate replacement Recommended. Carry the reference through launchers and workers; recover compatible launches without interrupting existing agents.
Detect replacement and restart BB Repairs this incident, but a full restart can interrupt active agents; restarting only a child leaves its supervisor's stale path.
BB-managed Node distribution Controls runtime lifetime, but adds packaging, security updates, native-addon and shared-library responsibilities. Copying Homebrew's binary alone is insufficient.
Pin Node / coordinate upgrades Workaround; leaves ongoing maintenance with the user.

Acceptance criteria: regression coverage for symlink retargeting/removal; compatibility and startup validation; actionable errors for unavailable/incompatible runtimes. Preserve empty-PATH GUI and Electron behavior from PR #257. Simply switching to node on PATH would regress that fix. Distinguish missing BB runtime from missing provider CLI or working directory.

What you ruled out

  • A Node version change is unnecessary: the fixture uses identical binaries; the incident changed only the Homebrew revision.
  • Incorrect launchd path: the service already used the stable alias.
  • No matching report found in open/closed issue and PR searches for Homebrew, Cellar, execPath/ENOENT, missing_executable, and Node upgrades. Related #2343 concerns GUI PATH; #3166 concerns provider CLI update ownership; #3207 concerns a startup registry race.

Suggested priority and effort

Medium: provider workers cannot start until a full service restart; no data loss observed. Effort depends on runtime selection and launcher propagation.

Written by Codex

AGENT GENERATED

Activity

  1. added theissue type on Oct 9, 2026
  2. added
    host
    providers
    confirmed-repro
    on Oct 9, 2026
  3. bb-slop-cop commented on Oct 9, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    • Classification: Bug · Priority: Medium · Effort: Medium · Areas: host, providers.
    • Reproduction report: REPRODUCED, high root-cause confidence · label: confirmed-repro.
    • Root cause: the agent runtime caches resolved process.execPath and uses the removed filename for new provider workers after the stable alias changes.
    • Verification: the real runtime model-discovery regression fails with ENOENT in two clean trusted-main checkouts at 635711463. Existing workers and fresh-runtime recovery both succeed; 38 adjacent tests pass. Linux scripted-provider verification, not a live enrolled-Mac/Codex/Claude integration.
    • No PR: preserving the runtime reference across launchers and validating replacements requires a cross-subsystem fix, outside the simple-fix gate.
  4. ariofrio commented on Oct 16, 2026

    @ariofrio
    ContributorAuthor

    Broader impact: this affects new Node-dependent subprocesses on the affected runtime, beyond provider model discovery. A connected host and surviving workers can conceal the failure until another child must start.

    Reproduced

    • Live agent submission also fails. On October 15, the same enrolled Mac failed turn.submit with Provider "codex" failed to start: spawn /opt/homebrew/Cellar/node@24/24.21.0_2/bin/node ENOENT. Read-only checks confirmed that file was gone and the stable alias now resolved to Node 24.22.0. This is a recurrence after another Node replacement.
    • Non-provider launch helpers fail too. Using byte-identical disposable Node copies on macOS/Node 22.23.2, I exercised the actual Browser Automation supervise() helper and watcher createForkChannel() helper. Both new launches returned ENOENT after removal; retained children and direct shell/native launches still worked. Helper-level verification: the browser target was /bin/sleep and the watcher child an IPC stub, not full Chrome/Parcel/UI integration.

    Additional scope established by source

    Audit pinned to 4c87fdec7b7effc022ff2ee31ec95c0a09c9ee62; these complete user flows were not separately reproduced:

    Area Exposure
    Agent/provider operations Agent startup and health, usage, installation checks/actions require the same worker-start gate.
    Host plugins Cold/replacement plugin workers use default fork(). An otherwise-running agent can therefore encounter failures when invoking a plugin.
    Browser sessions / filesystem refresh Session startup launches Node supervisors. The daemon uses the subprocess watcher backend, exposing initial watcher startup and recovery.
    Relaunch / update The supervisor, daemon relaunch, and npm update verification also use the executable. A child-only restart may not repair it.
    Server-side installs / ACP tools Plugin installs, skill installs, and ACP dynamic-tool MCP configuration reference their process's runtime too.

    Boundaries and routing

    • Not every request fails: live matching provider workers are reused. Existing agents may continue until a subsequent operation needs another child.
    • Impact follows the affected runtime: replacing Node on the mini does not remove a separate server's executable. Server-side install risks require that server's own runtime to disappear. Packaged desktop BB normally uses Electron, independently of Homebrew Node.
    • Suggest retaining host, providers, and confirmed-repro, and adding plugins and workspaces for routing. confirmed-repro should not imply every downstream flow above has been integration-tested. A fix should cover the shared runtime-lifetime assumption across launchers and workers.

    Written by Codex

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

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions