Repository navigation
Description
Bug: Pi provider update hardcodes npm install -g and fails when Pi is installed via bun
Summary
bb updates apply / Pi provider maintenance always runs npm install -g @earendil-works/pi-coding-agent@latest, even when pi was installed via bun (~/.bun/bin/pi). The install succeeds to mise's npm prefix (~/.local/share/mise/installs/node/.../lib/node_modules) which which pi never resolves to. pi --version stays stale, so bb reports 0.84.4 → 0.85.0 Failed — pi update exited successfully, but the provider could not verify the installed result.
Repro
- Install pi via bun (as
https://pi.devrecommends):bun add -g @earendil-works/pi-coding-agent→ pi at~/.bun/bin/pi→~/bin/pishim wraps it bb updates statusshows update available 0.84.4 → 0.85.0bb updates applyrunsnpm install -g @earendil-works/pi-coding-agent@latest(167 packages, success)pi --versionstill 0.84.4,~/.bun/install/global/.../package.jsonstill 0.84.4bun add -g @earendil-works/pi-coding-agent@latestis what actually updates it to 0.85.0
Environment
- macOS Darwin, mise node 22.23.0 (
npm prefix -g=~/.local/share/mise/installs/node/22.23.0) which -a pi:~/bin/pi→~/.bun/bin/pi(first),~/.local/share/mise/shims/pi,~/.bun/bin/pi,~/.local/bin/picat ~/bin/pi=exec "$HOME/.bun/bin/pi" "$@"- bb 0.42.0, provider-pi
PI_NPM_PACKAGE=@earendil-works/pi-coding-agent
Root cause
packages/provider-pi/src/bridge/provider-maintenance.ts (built to server/dist/builtin-plugins/provider-pi/dist/host.js):
npmCommand()/npmGlobalInstallCommand()hardcodedgetPiProviderInstallationStatus()only probesnpm prefix -g+npm list -g, setsinstallSourcevianpmGlobalInstallSource()installAction.commandandgetPiProviderInstallationRun().commandalwaysnpm install -g- Verification expects version bump after npm, so bun installs never verify
Proposed fix
Detect install source and match the package manager:
function bunCommand() { return "bun"; }
function bunGlobalInstallCommand(pkg: string) {
return { command: "bun", args: ["add","-g", `${pkg}@latest`], displayCommand: "bun add -g ..."};
}
function isBunInstalledPi(executablePath: string | null): boolean {
// realpath + shim content check + ~/.bun/install/global/.../package.json existence
// if executable resolves inside ~/.bun or shim wraps bun, or bun global pkg exists → true
}
function piInstallCommand(pkg: string, executablePath: string | null) {
return isBunInstalledPi(executablePath) ? bunGlobalInstallCommand(pkg) : npmGlobalInstallCommand(pkg);
}Then:
getPiProviderInstallationStatus()→installAction.command = piInstallCommand(PI_NPM_PACKAGE, resolvedExecutable).displayCommandgetPiProviderInstallationRun()→command = piInstallCommand(PI_NPM_PACKAGE, status.executablePath)- Optionally probe
bunsimilarly (bun pm pkg/ check~/.bun/install/global/node_modules/...) fornpmGlobalPackageVersionequivalent, or at least don't treat bun installs asexternal.
Fallback also fine: if bun --version succeeds and ~/.bun/bin/pi exists, prefer bun. If neither, keep npm.
Local workaround patched
Applied to /Applications/bb.app/.../provider-pi/dist/host.js (inserted helpers above, 901B delta) — bb updates status now 0.85.0 Up to date and future updates will use bun add -g when pi is bun-installed.
Checklist
- Detect bun vs npm in
provider-maintenance.ts -
probeBunGlobalPackage()or fs check for bun global - Unit test:
which pi→ bun shim still picks bun
Activity
bb-slop-cop commentedon Sep 5, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotClassified Bug · Priority Medium · Effort Low · labels
providers,provider-pi,confirmed-repro.Report: https://get-bb.github.io/reports/issues/3119.html — REPRODUCED with high root-cause confidence.
Root cause: Pi maintenance resolved the active executable but constructed both the displayed update action and executable plan with npm unconditionally. A focused wrapper-to-Bun regression test failed twice on clean trusted checkouts at
7d5de7301, then passed after the contained fix.Ready pull request: #3121
Use Bun to update Bun-managed Pi installations (#3121)