Repository navigation
Description
Summary
In agent threads, the host daemon puts the directory containing the bb CLI at the front of PATH. bb is also the executable name of Babashka, a Clojure scripting runtime whose scripts start with #!/usr/bin/env bb. So every Babashka script run from a bb thread (or anything it starts) runs the bb CLI instead and fails. I expected the user's own bb to keep working, since agents already get the CLI's absolute path in BB_CLI.
Versions and environment
- bb 0.43.4 (desktop app, Linux AppImage); CachyOS Linux, kernel 7.2.3
- claude-code provider, Claude Code 2.1.283
- Babashka v1.13.224 (installed with mise); it is the
bbon the user's login-shell PATH - Login shell: fish
Steps to reproduce
-
Install Babashka so that
bbresolves to it in a normal terminal (bb --versionprintsbabashka v…). -
In a bb agent thread, run:
printf '#!/usr/bin/env bb\n(println "hello from babashka")\n' > /tmp/bb-repro.clj chmod +x /tmp/bb-repro.clj /tmp/bb-repro.clj
Did not reproduce: the same script run from a normal terminal outside bb prints hello from babashka.
Expected vs actual
Expected:
hello from babashka
Actual (exit 1):
error: unknown command '/tmp/bb-repro.clj'
Commands: browser, status, settings, project, provider, manager, machine, server, updates, terminal, thread, environment, file, theme, plugin, marketplace, skill, guide, diagnostics, voice
Plugins add commands only while they are installed and enabled. If '/tmp/bb-repro.clj' is a plugin command, check `bb plugin list`.
In the same thread:
$ command -v bb
/tmp/.mount_bb.AppkECNgb/resources/app.asar.unpacked/node_modules/bb-app/host-daemon/dist/bb
Evidence
prepareRuntimeShellEnvbuilds the agent shell env withPATH: prependPath(options.bbExecutableDirectory, inheritedPath)and also setsBB_CLIto the absolute CLI path:bb/apps/host-daemon/src/runtime-shell-env.ts
Lines 401 to 414 in 4354b88
export function prepareRuntimeShellEnv( options: PrepareRuntimeShellEnvOptions, ): NonNullable<AgentRuntimeOptions["shellEnv"]> { const bbExecutablePath = options.bbExecutablePath ?? resolveBbExecutablePathInDirectory(options.bbExecutableDirectory); const shellEnv: NonNullable<AgentRuntimeOptions["shellEnv"]> = { PATH: prependPath( options.bbExecutableDirectory, options.inheritedPath ?? process.env.PATH, ), BB_CLI: bbExecutablePath, BB_SERVER_URL: options.serverUrl, }; prependPathputs the directory first:bb/apps/host-daemon/src/runtime-shell-env.ts
Lines 130 to 137 in 4354b88
function prependPath( executableDirectoryPath: string, inheritedPath?: string, ): string { return inheritedPath ? `${executableDirectoryPath}${delimiter}${inheritedPath}` : executableDirectoryPath; } - Thread where this was found and reproduced:
thr_y8a8ded53t(projectproj_99rhvwp7ur, environmentenv_kpkxu495rk).
What you ruled out
- Not Source host daemon injects an unbuilt CLI into sandboxed threads from fresh worktrees #1970: that was a source-run daemon injecting an unbuilt CLI. Here the CLI works; the problem is its name shadowing another program.
- Not Codex update succeeds via npm -g, then verification reads a shadowed PATH binary #4009: that is Codex's own binary being shadowed after an npm update.
- Reproduced live on 0.43.4. I did not install 0.44.0; the code above on
mainat4354b88still prepends the directory (read, not run). - No user-side workaround that keeps both working: removing the directory from PATH makes bb's own skills and plugins, which call bare
bb, run Babashka instead. The only fix today is rewriting every Babashka script's shebang.
Suggested priority and effort (optional)
Medium: hits every Babashka user who runs scripts from bb threads; workaround is rewriting script shebangs; no data loss. Effort probably low: append the directory instead of prepending it, or drop it from PATH and rely on BB_CLI, or ship the CLI under a name nothing else uses.
Checks
- I reproduced this on the latest release or on
main, or I say above that I could not. - I searched open and closed issues for the same problem.
- If an agent wrote this, the body ends with
> AGENT GENERATEDand links the thread or report.
Activity
SawyerHood commentedon Sep 30, 2026
Report: https://get-bb.github.io/reports/issues/4417.html
PARTIALLY REPRODUCED in two clean checkouts: the actual runtime environment builder changes Linux command lookup and env-shebang execution from an existing bb stub to the prepended product stub. Baseline and explicit-path controls pass; three desired-behavior assertions fail identically. Real Babashka, fish and provider sessions were not exercised.
Build every provider CLI's environment with one builder (#7722)