Repository navigation
Description
Summary
Every bb call from an automation script starts a new copy of itself, over and over, and never finishes. Each copy is a Node process of about 65 MB. The script hits its timeout, or the machine runs out of memory first. On my server the kernel OOM-killed bb.service twice within five minutes, which cut off every running thread. I expected the script's bb call to run the CLI once.
Versions and environment
- Reproduced on
[email protected]from npm (gitHead7125b90a6f), and on a build ofmainat0ba941bed4.runBundledCliCommandis unchanged onmainatf8c0701e94. - Ubuntu 24.04, Linux 6.8. Node 22.23.4 in the repro; the service uses Node 24.22.1. Installed with
npm i -gand run as a systemd user service.
Steps to reproduce
Minimal version, without an automation. It uses a throwaway data dir and a launcher shaped like the generated ~/.bb/bin/bb:
D=$(mktemp -d); npm install --prefix "$D" --no-audit --no-fund [email protected]
mkdir -p "$D/data/bin"
printf '#!/bin/sh\nexport BB_DATA_DIR="%s"\nexec "%s" "%s" "$@"\n' "$D/data" "$(command -v node)" "$D/node_modules/bb-app/dist/bb.js" > "$D/data/bin/bb"
chmod +x "$D/data/bin/bb"
"$D/data/bin/bb" --version # prints the version
BB_CLI="$D/data/bin/bb" setsid "$D/data/bin/bb" --version &
sleep 3; pgrep -fc "$D/node_modules/bb-app/dist/bb.js"
pkill -KILL -f "$D/node_modules/bb-app/dist/bb.js"The trigger in the product: an installed bb (so BB_CLI_LAUNCHER is set) runs a script automation whose script calls "$BB_CLI" ....
Expected vs actual
Expected: the second command prints the version once.
Actual: no output, and 19 to 33 bb.js processes after 3 seconds over two runs, still growing. On the server:
2026-10-28T05:57:48+00:00 systemd[1419]: bb.service: Failed with result 'oom-kill'.
2026-10-28T05:57:48+00:00 systemd[1419]: bb.service: Consumed 1h 22min 58.040s CPU time, 26.4G memory peak, 0B memory swap peak.
2026-10-28T06:02:15+00:00 systemd[1419]: bb.service: Failed with result 'oom-kill'.
Evidence
- Since One host toolchain for executable discovery, child PATH, and proxy/CA defaults #6194, the automations script runner resolves
bbwithhostToolchain.resolve("bb"), which triesBB_CLI_LAUNCHERfirst: host-toolchain.ts#L325-L327. The runner then sets the script'sBB_CLIto that launcher: script-runner.ts#L46-L49, #L284-L296. - The launcher runs
bb-app/dist/bb.js.runBundledCliCommandrunsBB_CLIwhenever it is set, without a loop guard: launcher.ts#L2750-L2767. It runs the launcher, which runsbb.jsagain. - The CLI already guards its own re-exec with
BB_CLI_REEXEC(Inject BB_CLI and re-exec trampoline for agent shells #554): bb-cli-reexec.ts#L46. Thebb-appentry neither sets nor checks it. - The automation started failing on the first run after the deploy that had something to send with
bb thread tell. Earlier runs had no events and never calledbb.
What you ruled out
- Agent threads: their
BB_CLIis the bundled CLI, not the launcher. The MCP plugin keeps theBB_CLIit inherits. So neither one loops in a default install. - Not a duplicate: no open or closed issue matches. LaunchAgent server has no node on PATH, so the MCP server (and other plugins) can't run the bb CLI #5807 asked for the launcher to be preferred, which this lookup does. It doesn't cover the loop.
- The newer commits on
main: Keep bb Node processes alive with scheme-less proxies and bypass the proxy for loopback #6394 also fixes regressions from One host toolchain for executable discovery, child PATH, and proxy/CA defaults #6194, but it doesn't touch this path.
Suggested priority and effort
High: any script automation that calls bb can take down the server, and running threads are lost when it does. The workaround is to pause those automations. Effort is low; I'll send a PR.
Found in bb thread thr_smfiqpe3ik and investigated in thr_h7xjtip5xk.
AGENT GENERATED
Activity
bb-slop-cop commentedon Oct 28, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilothost,cli,automations,confirmed-repro.BB_CLIwithout honoring the existing re-exec guard. When the override points back to its launcher, each child repeats the same delegation.Stop bb-app's CLI entry from re-launching itself through BB_CLI (get-…
pascal-de-ladurantaye commentedon Oct 29, 2026
Still affects the desktop 0.48.0 release on macOS, because the fix doesn't ship in it: #6436 merged as
544e49c1feat 2026-10-28T19:07Z, anddesktop-v0.48.0was cut at 17:17Z.compare/desktop-v0.48.0...544e49c1feshows the fix 11 commits ahead and 0 behind.What I observed (macOS, bb desktop 0.48.0,
/Applications/bb.app):"${BB_CLI:-bb}" machine list --all --jsononce, withBB_CLI=~/.bb/bin/bbandBB_CLI_LAUNCHER=~/.bb/bin/bbin its environment.wake.sh → bb.js machine list → bb.js machine list → …, each process the parent of the next. There were 835 processes after about 1m40s and 890 a few seconds later, about 47 GB RSS in total (sum ofps -o rss). I stopped it withpkill -KILL.unset BB_CLIat the top of automation scripts.Not reproduced again on purpose; this is what I saw live. Filed by mistake as #6557, which I'm closing as a duplicate of this.
Geczy commentedon Oct 29, 2026
Need this fix asap, how can I get on the nightly build?
Prepare bb-app 0.48.1 (#6616)