generated from BlackHatMagic/Template-Bare
fix: discover mise-managed Node and Pi binaries #2
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/mise-node"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
PR Type Selection
Problem
On a laptop where Node is installed with mise and Obsidian is launched from the desktop, Pi Chat reported that Pi could not run because
nodewas not found. The plugin found a Pi install or shim, but the GUI session had no mise-activated shell PATH, so Pi'sexec nodefailed.Root Cause Analysis
piSearchPath()only appended mise shims to the inherited PATH. A shim is not an actual Node binary, and a GUI-launched Obsidian may not have a mise config active for the vault working directory. Pi's npm bin script runsexec node, which therefore had no executable to find.Fix Description
MISE_DATA_DIR,XDG_DATA_HOME,~/.local/share/mise, macOS Application Support, Windows LocalAppData/AppData) for:installs/node/<version>/bin/nodebinaries;pibins under those Node versions;installs/npm-*-pi-coding-agent/<version>/node_modules/.bin/pibins, not only alatestsymlink;cli.jsentry point as a fallback.PI_OBSIDIAN_PIas hard overrides.Testing Evidence
tests/launcher.test.tsnow creates a synthetic mise data dir with Node and a versioned Pi npm install, then verifies discovery, PATH ordering,resolvePiLaunch(), and the child environment.bun run checkpasses: typecheck + 15 tests.bun run buildpasses.PiClientsmoke test underenv -i HOME=... PATH=/usr/local/bin:/usr/bin:/bin; it discovered mise Node, started Pi, hydrated 29 models, and exited cleanly.Checklist
Pi code review
1 new actionable finding
src/launcher.ts:178Merged three candidate reviews of mise Node/Pi discovery and PATH wiring; verified ordering change and launch/env callers by read-only inspection without running builds or tests.
Change walkthrough
src/launcher.ts,src/settings.tsREADME.mdtests/launcher.test.tsReview effort: 3/5.
Static observations (not validation results)
Reviewed
ed56bff7ab976d6df7a952f8f8a87c4eec1d85e9withproxy/glm-5.3-flash + proxy/gpt-6.1-sol + proxy/muse-spark-1.3 → proxy/muse-spark-1.3. Automated advisory review; no project commands or tests were executed.@ -53,1 +176,3 @@dirs.push(const layout = miseLayout(home, env, platform);const dirs = [...layout.nodeBins,[P2] Discovered mise Node shadows working inherited Node
piSearchPath prepends all discovered mise Node/Pi bins ahead of inherited PATH, so a previously working Node/Pi pair can run under an unrelated mise Node version ordered only by latest alias/mtime.
Trigger: Obsidian inherits a working Node/Pi via PATH while mise data dir retains another Node version; no activation needed for it to shadow.
Impact: Pi script resolves exec node to the shadowing version and can fail at startup, leaving chat unavailable with no Pi-path setting to restore prior Node.
Evidence: src/launcher.ts:172-174 prepends layout.nodeBins/piBins before env.PATH; miseLayout collects every installs/node version ordered by newestFirst mtime/latest alias; piEnvironment exports reordered PATH used at src/session.ts:108 into PiClient spawn; configured-path guard selects only Pi command. Base piSearchPath kept inherited PATH first.
Pi code review
0 new actionable findings
No new actionable findings. Previously reported issues, if any, are tracked below.
Earlier findings: 1 rechecked
src/launcher.ts:178, first reported in review #238) — src/launcher.ts piSearchPath now builds [...inherited, ...layout.nodeBins, ...layout.piBins, ...shimDirs] after filtering shimDirs from inherited, so inherited Node/Pi wins over discovered mise bins.Merged 3 candidate reviews of mise Node/Pi discovery; verified prior PATH-shadowing defect is fixed in current code. No new evidence-backed defects; checks were read-only without running tests.
Change walkthrough
src/launcher.ts,src/settings.tstests/launcher.test.tsREADME.mdReview effort: 3/5.
Static observations (not validation results)
Reviewed
0cc1d69ef0838c9ef2a0539a7878d5884d0187ecwithproxy/glm-5.3-flash + proxy/gpt-6.1-sol + proxy/muse-spark-1.3 → proxy/muse-spark-1.3. Automated advisory review; no project commands or tests were executed.