Skip to content

fix(desktop): discover bun-installed agent CLIs in ~/.bun/bin - #3343

Open
linxule wants to merge 4 commits into
block:mainfrom
linxule:fix-bun-bin-discovery
Open

fix(desktop): discover bun-installed agent CLIs in ~/.bun/bin#3343
linxule wants to merge 4 commits into
block:mainfrom
linxule:fix-bun-bin-discovery

Conversation

@linxule

@linxule linxule commented Jul 28, 2026

Copy link
Copy Markdown

Problem

common_binary_paths() probes mise shims, ~/.local/bin, volta, asdf, and (further down resolve_command_uncached) nvm's default bin dir — but not bun's global bin directory, ~/.bun/bin.

bun's installer appends its bin dir to ~/.zshrc / ~/.bashrc, which are interactive-only. A login shell never sources them, so find_via_login_shell() can't recover the path either. That's the same failure mode already called out in this file for nvm:

// Check nvm's default Node.js bin directory — nvm initializes via
// ~/.zshrc (interactive) which is not loaded by a login shell, so
// `node`, `npm`, and npm-global shims installed there are otherwise
// invisible.

So for a GUI-launched desktop app, every rung of the resolution ladder misses a bun-installed CLI:

  1. workspace dev dirs — no
  2. command_looks_like_path — no, presets use bare names
  3. Buzz-managed npm/node dirs — no
  4. current process PATH — launchd's minimal PATH on a Finder launch
  5. find_via_login_shell.zshrc not sourced
  6. common_binary_paths()~/.bun/bin absent
  7. nvm default bin — no

This matters because bun is a common install route for the agent CLIs Buzz targets. Kimi Code in particular ships as an npm package (@moonshot-ai/kimi-code), so bun add -g puts it at ~/.bun/bin/kimi — exactly where discovery doesn't look.

Reproduction

On macOS with codex and kimi installed via bun, launching Buzz from Finder:

  • Kimi Code shows "CLI needed"
  • both CLIs run fine in an interactive terminal

Probing the way find_via_login_shell does, in a clean environment:

$ env -i HOME=$HOME /bin/zsh -l -c 'command -v -- codex; command -v -- kimi'
(nothing)

Launching the app with the bun dir on PATH resolves both immediately:

$ env PATH="$HOME/.bun/bin:$PATH" /Applications/Buzz.app/Contents/MacOS/buzz-desktop

Change

One entry appended to the home-relative list in common_binary_paths(). It goes last so it cannot shadow a directory that already resolves — the change can only add resolutions, never alter existing ones.

Testing

cargo fmt --check passes.

I was not able to run the full just ci gate locally: ring 0.17.14 fails to build in this environment against the macOS 26.2 SDK (cc error compiling p256-nistz.c), which is unrelated to this change. Relying on CI for the rest — the diff adds one PathBuf to an existing Vec<PathBuf> and introduces no new API.

Notes

  • Related to Improve Kimi Code runtime discovery #3084, which adds ~/.kimi-code/bin for the same class of GUI-launch discovery failure. That covers Kimi's standalone installer; this covers the bun/npm-global install route. They're complementary — I've left a note on that PR.
  • Only ~/.bun/bin is added. bun's global packages live under ~/.bun/install/global/node_modules but are symlinked into ~/.bun/bin, so the single directory is sufficient.
  • Worth noting ~/.bun/bin contains no node/npm/npx, so appending it can't shadow a system Node toolchain.

common_binary_paths() probes mise, volta, asdf, nvm and ~/.local/bin, but
not bun's global bin directory. bun's installer appends ~/.bun/bin to
~/.zshrc (interactive), which a login shell does not source, so the
login-shell fallback in find_via_login_shell() cannot recover it either
-- the same failure mode already documented for nvm.

The result is that agent CLIs installed via bun are undiscoverable from a
GUI-launched desktop app, and the runtime shows "CLI needed" for tools
that run fine in an interactive terminal.

Appended last so it cannot shadow a directory that already resolves.

Signed-off-by: Xule Lin <43122877+linxule@users.noreply.github.com>
@linxule
linxule requested a review from a team as a code owner July 28, 2026 17:28
@wpfleger96
wpfleger96 enabled auto-merge (squash) July 28, 2026 20:06
Fizz (agent) and others added 3 commits July 28, 2026 15:14
Co-authored-by: Phuoc (Phu) Do <91568955+dophsquare@users.noreply.github.com>
Signed-off-by: Phuoc (Phu) Do <91568955+dophsquare@users.noreply.github.com>

* origin/main:
  chore(ci): bump desktop smoke E2E timeout to 30 minutes (block#3409)
  release(chart): publish 0.1.7 (block#3393)
  feat(acp): steer claude-code and codex agents via _session/steering (block#3007)
  feat(desktop): apply WebKit rendering workarounds at startup on Linux (block#3271)
  fix(desktop): stabilize flaky DM expansion E2E ordering assertions (block#2004)
  docs(contributing): document the Linux system libraries just ci requires (block#3396)
  fix(desktop): paint community rail full height (block#3382)
  fix(acp): disable goose cron scheduler in managed agent children (block#3144)
  feat(desktop): add custom harness inline from agent dialogs (block#3252)
  chore(compose): remove stale typesense env vars (block#3332)
  feat(desktop): refine agent catalog sharing (block#2439)
  fix(desktop): keep drafts out of the Inbox All view (block#3217)
  docs: restructure DCO guidance into scannable subsection (block#3337)
  Unify mobile loading spinners (block#3314)
  fix(desktop): restore the inbox icon in the sidebar (block#3341)
  fix(desktop): gate codex-acp on a minimum supported version (block#3254)
  feat(cli): add users set-status command for NIP-38 profile status (block#3253)
  fix(composer): scope multiline block formatting (block#3246)
Adding ~/.bun/bin to the discovery paths takes discovery.rs to 1861
lines after merging main. Bump the existing override by one to match.

Co-authored-by: Phuoc (Phu) Do <91568955+dophsquare@users.noreply.github.com>
Signed-off-by: Phuoc (Phu) Do <91568955+dophsquare@users.noreply.github.com>
* origin/main:
  feat: add explicit entry for claude-opus-5 in model config (block#2831)
  fix(desktop): clear stale thread new-message pill (block#3411)
  fix(ci): ratchet file sizes against the base tree (block#3352)

Co-authored-by: Phuoc (Phu) Do <91568955+dophsquare@users.noreply.github.com>
Signed-off-by: Phuoc (Phu) Do <91568955+dophsquare@users.noreply.github.com>

# Conflicts:
#	desktop/scripts/check-file-sizes.mjs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants