Repository navigation
fix(pi): decline to load on Node instead of failing the session - #615
Conversation
Pi treats an extension that throws while loading as fatal for the session, so installing the adapter made a plain `pi` launch exit 1 with no model call and its only hint being to start Pi without extensions. Warn once with a pasteable Bun command and register nothing instead. Misconfiguration that is real — an unusable store, a config the engine cannot honour — still throws, where a silent fallback would hide memory being off. Adds integration/pi/node-launcher.test.ts, which installs the packed tarball and runs it under Node, and pins Node 22 for the pi job because Pi 1.7.0's bundle does not parse below it. Closes #610
|
Verified on the branch, not from the diff. Packed the branch with That ordering matters and was done in that order: the same test file produced the failure first, so the assertion is known to be capable of failing rather than passing by construction. The Local gates: Two notes for whoever reads this next. The Declining is the right shape here, but it is the interim shape. The intended end state is that this warning never prints because the store no longer needs |
|
🎉 This PR is included in version 0.40.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
# [0.41.0](v0.40.2...v0.41.0) (2026-11-30) ### Bug Fixes * **package:** state the Bun floor the node:sqlite lock actually needs ([38bf33a](38bf33a)) * **runtime:** set MIN_BUN where node:sqlite lands ([b2deb49](b2deb49)) * **runtime:** the text reader strips a BOM like the Bun.file call it replaced ([a3930f6](a3930f6)) ### Features * **runtime:** native installs on plain Node for the Pi-family adapters ([162689f](162689f)), closes [#612](#612) [#615](#615)
Completes abogartz#612 option 1 on top of the lock-layer spike. The remaining Bun-specific sites on every host-session path now run on Node-native primitives in src/core/runtime/: fs reads/writes, a single-level glob pinned pair-by-pair against Bun.Glob (test/portable/glob-parity.test.ts caught two drifts: symlinks are not file matches by default, and Bun.file().exists() is file-typed), and a spawnSync shim without Node's 1MB maxBuffer cliff on git ls-files. The store's private-before-the-bytes contract moved from spying Bun.write to the named seam setPrivateWriteForTests: same assertions, real write path. The abogartz#615 decline-on-Node stopgap retires: extension.ts loads the engine everywhere, and integration/pi/node-launcher.test.ts now pins the opposite contract end-to-end — packed tarball, fresh Pi home, plain pi, print-mode session on Node 22, grounded memory_remember row lands in the store through node:sqlite. README.pi.md installs with plain pi; the unreleased-adapter prose in README.oh-my-pi.md and the reference page catches up to 0.40.x. ADR 0010 records the choice and the numbers.
Installing the Pi adapter into a normal Pi installation makes Pi refuse to start. The adapter threw while the extension was loading, Pi treats a load failure as fatal for the session, and the only remedy the host offers is
pi -ne— start with extensions disabled.pi installreports success, so the failure surfaces on the next ordinary launch, which is the worst ordering available.Decline instead of throwing: register nothing, warn once with a command the user can paste, and let the host continue. The warning names Bun and prints the entry point the host resolved for itself, because a path inside a repository does not exist in an installed package. Failures that are genuine misconfiguration — an unusable store, a config the engine cannot honour — still throw out of
installPiMemory, where a silent fallback would hide the fact that memory is off.Closes #610.
Validation, fail-before then the same test after. Packed with
bun pm pack, installed withbun add --ignore-scriptsinto a consumer directory, registered withpi install, then launched against the packedsrc/adapters/pi/extension.tsunder Node 22.23.4 with the scripted provider. Before:exit=1, stdout empty, stderrFailed to load extension …: Pi memory requires Bun. … Hint: Start without extensions using "pi -ne". After:exit=0, the turn completes, stderr carries the three warning lines verbatim, and the request the host sent the model lists native tools while containing zero names fromMEMORY_TOOLS— declining is total, and the assertion that native tools are present keeps that check from passing on a session with no tools at all.bun test ./integration/pi/node-launcher.test.ts— 1 passed, 0 failed, 5 assertions. Unit suitebun test ./test/ --parallel=4 --timeout=20000— 2130 passed, 23 skipped, 0 failed.bun run lint:comments,bun run typecheck,bun run lintandbun x tsc --noEmit -p integration/pi/tsconfig.json— exit 0.Two measured facts sit under the new test. Pi 1.7.0 declares
engines.node >=22.19.0, and its bundle does not parse below Node 22: under Node 20.20.2 it dies before extensions load withSyntaxError: The requested module 'node:module' does not provide an export named 'enableCompileCache'. So thepijob now pins Node 22 rather than inheriting whatever the runner image ships — the same class of image-version flake as #609 — andPI_TEST_NODEoverrides the interpreter for a machine whosenodeon PATH is older than the host's floor.Not in scope: whether memory should work on the Node launcher at all. That is #612, and this file is deliberately shaped so that flipping its last assertion to "MEMORY_TOOLS are offered" is the proof that #612 landed.