You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
provider-pi bridge: resumed session can use a stale extensionPath from a dead bridge worker's temp dir (ENOENT on pi-tools-*.json at extension load) #5350
A pi-provider thread failed at startup with pi exited (code 1): the extension pi was told to load (--extension) lived in one bridge worker's temp dir, while the PI_BB_TOOLS_FILE env pointed at a tools JSON in a different bridge worker's temp dir that had already been cleaned up. The user's ~/.pi config (settings, extensions, auth) is unaffected — pi runs fine headless.
Error
pi exited (code 1, signal null): Error: Failed to load extension "/var/folders/.../T/bb-provider-bridge-provider-pi-31ArBw/pi/bb-pi-extension.mjs": Failed to load extension: ENOENT: no such file or directory, open '/var/folders/.../T/bb-provider-bridge-provider-pi-wb9hmr/pi/pi-tools-92942-1791605506411-338576cb95a64.json'
Hint: Start without extensions using "pi -ne".
Note the two different per-worker temp roots in one spawn:
spawnAndVerify() writes pi-tools-${process.pid}-${Date.now()}.json into this.options.scratchDir, then spawns pi with --extension this.options.extensionPath and env PI_BB_TOOLS_FILE pointing at that file. It deletes the tools file on child exit.
The bridge worker's temp dir (bb-provider-bridge-provider-pi-*, created by the worker bootstrap) is per-process and force-removed on worker exit.
bb-pi-extension.mjs is staged/cached per worker process (requireExtensionPath), so a worker restart always produces a new root for both the extension and the tools file.
The failing spawn combined an extensionPath from a previous worker's temp root with scratchDir/tools from the current worker — i.e. a resumed/forked session received a persisted extensionPath that the new worker never staged, and the referenced tools file was already gone (worker exit cleanup and/or macOS tmp purge). pi then exits code 1 at extension load and the thread dies.
Both temp roots involved are purged now; retrying the turn / starting a fresh pi thread works around it because everything is restaged consistently.
Suggested fix
On session start/resume, treat a persisted extensionPath as untrusted: verify it exists inside the current worker's temp root, and restage the extension in the current scratch dir if it doesn't match (e.g. compare the dirname against the active scratch root before spawn, or simply always restage per session like the tools file already is).
Workaround
Retry the failed thread or start a new pi thread — no user-side pi config needs repair.
Evidence: Real Pi resumed and forked successfully after the previous worker's temporary root was removed, in two clean checkouts of trusted origin/main (3912f4aae).
Root cause: Not established. Current main constructs worker-local extension and tools paths rather than restoring a persisted extension path. The reported macOS/Pi 1.1.0 setup was not replicated; the report documents this limitation.
No pull request: No regression reproduces the reported defect on trusted main, so a production fix was not safe.
Activity
bb-slop-cop commentedon Oct 11, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotproviders,provider-pi.no-repro.origin/main(3912f4aae).