Repository navigation
Description
Symptom
The model picker for the Pi provider shows:
Could not load models for Pi.
pi exited (code 1, signal null): Error: Failed to load extension
"/…/bb-provider-bridge-provider-pi-<A>/pi/bb-pi-extension.mjs":
Failed to load extension: ENOENT: no such file or directory, open
'/…/bb-provider-bridge-provider-pi-<B>/pi/pi-tools-<pid>-<ts>.json'
Pi threads themselves keep working; only provider.list_models fails.
Environment: bb 0.46.0, macOS 27.0, pi 1.1.0, builtin provider-pi plugin.
Root cause
Two problems combine.
1. Provider-scoped env froze into the whole app tree.
The bb app was at some point (re)launched from a process running inside a Pi bridge session context, so its environment contained that session's PI_BB_TOOLS_FILE — a temp manifest path inside that bridge worker's mkdtemp dir. The variable then propagated to every descendant: Electron main → bb-app-bridge → server → host daemon → all provider bridge workers. Verified live with ps eww: the same stale PI_BB_TOOLS_FILE was present on the app main process, the server, the host daemon, and freshly spawned provider-pi bridge workers, while the referenced file no longer existed (bridge workers rm -rf their temp dir on exit, so the path is guaranteed stale once that worker dies).
2. The catalog spawn does not override PI_BB_TOOLS_FILE.
In provider-pi, per-thread session spawns write a fresh pi-tools-*.json into the worker scratch dir and pass PI_BB_TOOLS_FILE explicitly. The model-catalog child, however, is spawned with buildPiChildEnv({}) and no override, so it inherits the worker's own environment. The bb pi extension reads PI_BB_TOOLS_FILE at load time → ENOENT → pi exits 1 → provider.list_models fails.
Suggested fixes
spawnCatalogshould pass a fresh tools manifest the way session spawns do — orbuildPiChildEnvshould dropPI_BB_TOOLS_FILEwhen the spawn does not supply one. The second option is more robust against any stale inherited value.- Sanitize provider-scoped env in the app relaunch / daemon spawn paths — strip
PI_*from inherited environment the same wayBB_*is stripped from provider children — so launching bb from inside a provider session cannot freeze provider env into the app tree.
Workaround
Quit bb completely and relaunch it through LaunchServices (Dock/Finder, or open -a /Applications/bb.app from any shell — open does not forward the calling shell's environment). An in-process relaunch preserves the polluted environment and does not fix it.
Activity
bb-slop-cop commentedon Oct 11, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotClassification: Bug · Priority High · Effort Low ·
providers,provider-pi.Report: REPRODUCED — high root-cause confidence. Applied
confirmed-reproafter reproducing the failure in two clean trusted-main checkouts.Root cause: Catalog children inherit a deleted session tool-manifest path; the actual BB Pi extension opens it during initialization and exits with ENOENT. The reproduction exercises the real catalog and extension with the repository's Pi subprocess fixture; macOS relaunch ancestry remains unverified.
Fix: PR #5352 drops only the inherited manifest path before applying explicit session overrides. The regression fails before the fix and passes afterward. All 7 catalog tests and 207 provider tests pass, with one Bun-specific skip; lint, typecheck, and three Pi parity recordings pass. Two files, 22 changed text lines. The PR is ready for review and has not been merged.
cameronm123 commentedon Oct 11, 2026
Correction to the workaround: on macOS 27,
opendoes forward the calling shell's environment to the launched app. We verified this live — relaunching bb viaopen -a /Applications/bb.appfrom a process whose env still carried the stalePI_BB_TOOLS_FILEreproduced the pollution in the freshly launched app (launchd session env was clean, no shell profile exports it). The workaround only works when theopencall itself runs from a clean environment, e.g.:This also explains the original pollution entry: bb was launched (via
openor an equivalent relaunch path) from a process running inside a Pi bridge session, which froze that session'sPI_BB_TOOLS_FILEinto the app environment. It strengthens suggested fix 2: the relaunch path should strip provider-scoped env (PI_*) explicitly rather than relying on LaunchServices to sanitize it.Discard inherited session manifests when launching Pi children (get-b…