fix(pi-plugin): resolve the OMP host CLI via bin.omp — @oh-my-pi/pi-coding-agent declares no bin.pi - #413
fix(pi-plugin): resolve the OMP host CLI via bin.omp — @oh-my-pi/pi-coding-agent declares no bin.pi#413Qiiks wants to merge 2 commits into
Conversation
…oding-agent declares no bin.pi
PiSubagentRunner's resolvePiInvocation positively identifies the running
host by package name (@oh-my-pi/pi-coding-agent is in
PI_CODING_AGENT_PACKAGE_NAMES) but then resolvePiBin only accepts
bin.pi. OMP's package declares bin: { omp: dist/cli.js }, so resolution
returns null, the fallback cascade misses (no bundled
@earendil-works/pi-coding-agent peer, no pi shim on PATH), and the
runner spawns bare 'pi' — 'Executable not found in $PATH: "pi"'
(spawn_failed) for every MC subagent (historian, dreamer, recomp,
wrapup, upgrade, sidekick) on hosts without Pi installed.
Accept the omp bin key after pi when resolving the host CLI. The
containment guard, realpath canonicalization, and fallback ordering
are unchanged; a Pi host with bin.pi still resolves identically.
| ? (bin as Record<string, string>).pi | ||
| : undefined; | ||
| const binKeys = ["pi", "omp"]; | ||
| let binEntry: string | undefined; |
There was a problem hiding this comment.
OMP branch lacks regression coverage
The new bin.omp selection path has no committed fixture or assertion, so a later resolver change can restore the bare-pi fallback for OMP-only installations without the test suite detecting that all hidden child-agent workflows are broken.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
🟢 Approval recommended
The change is small, targeted, and aligns with the PR description; only minor formatting nits were identified.
Pull request overview
Updates Pi CLI resolution so Magic Context subagents can spawn correctly on OMP (oh-my-pi) hosts where the host package exposes its CLI via bin.omp instead of bin.pi, preventing fallback to a missing pi executable.
Changes:
- Extend
resolvePiBinto acceptbin.omp(in addition tobin.pi) when selecting the host CLI entrypoint. - Update the function doc comment to describe the Pi vs OMP
binkey difference and the containment/realpath guard behavior.
File summaries
| File | Description |
|---|---|
| packages/pi-plugin/src/subagent-runner.ts | Adjusts package bin resolution to recognize OMP’s bin.omp, avoiding PATH-based pi fallback on OMP-only installs. |
Review details
Suppressed comments (1)
packages/pi-plugin/src/subagent-runner.ts:183
- There are two consecutive blank lines after
if (!binEntry) return null;(introduced in this change). This creates a stray extra vertical gap and may violate formatting/lint rules if the repo enforces them.
if (!binEntry) return null;
const packageRoot = resolvePath(found.dir);
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if ( | ||
| typeof bin === "string" && key === "pi" | ||
| ) { | ||
| binEntry = bin; | ||
| break; | ||
| } |
There was a problem hiding this comment.
1 issue found across 1 file
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/pi-plugin/src/subagent-runner.ts">
<violation number="1" location="packages/pi-plugin/src/subagent-runner.ts:162">
P2: Add a regression test with an OMP-only manifest (`bin.omp`) that asserts the resolver returns the host invocation, so this branch cannot regress to the bare `pi` fallback unnoticed.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| typeof (bin as Record<string, unknown>).pi === "string" | ||
| ? (bin as Record<string, string>).pi | ||
| : undefined; | ||
| const binKeys = ["pi", "omp"]; |
There was a problem hiding this comment.
P2: Add a regression test with an OMP-only manifest (bin.omp) that asserts the resolver returns the host invocation, so this branch cannot regress to the bare pi fallback unnoticed.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/pi-plugin/src/subagent-runner.ts, line 162:
<comment>Add a regression test with an OMP-only manifest (`bin.omp`) that asserts the resolver returns the host invocation, so this branch cannot regress to the bare `pi` fallback unnoticed.</comment>
<file context>
@@ -157,16 +159,27 @@ function resolvePiBin(
- typeof (bin as Record<string, unknown>).pi === "string"
- ? (bin as Record<string, string>).pi
- : undefined;
+ const binKeys = ["pi", "omp"];
+ let binEntry: string | undefined;
+ for (const key of binKeys) {
</file context>
Adds a regression test with an @oh-my-pi/pi-coding-agent fixture that declares only bin.omp, asserting resolvePiInvocation returns the host invocation (execPath + realpathed dist/cli.js) instead of falling through to the bare 'pi' PATH fallback. Guards the OMP-only branch against silent regression flagged by review. Also flattens the bin-key loop's string-bin condition to match file style and drops a stray double blank line.
|
Addressed all three review findings in 31b7002:
Verification: new test passes (1 pass/0 fail with |
…pi/pi-coding-agent declares no bin.pi, so every subagent spawn on an OMP host without a standalone pi fell through to the bare-pi fallback since the #400 fix; with regression fixtures for the omp/pi/string/neither bin shapes Co-authored-by: Alfonso <alfonso-magic-context@users.noreply.github.com>
Co-authored-by: Alfonso <alfonso-magic-context@users.noreply.github.com>
|
Verified and landed. The registry manifest for Your commit is on master with your authorship (cherry-picked as This ships in v0.41.2 with a credit in the release notes. Closing the PR since GitHub cannot mark a cherry-picked merge as merged; the change is in. |
Problem
On OMP (oh-my-pi) hosts without a standalone
piinstall, every Magic Context subagent — historian, dreamer, recomp, wrapup, upgrade, sidekick — fails at spawn:This surfaced as
/ctx-statusreportingspawn_failedand the historian never running (context compaction silently dead) after the user removed Pi.Root cause
resolvePiInvocationpositively identifies the OMP host: it walks up fromprocess.argv[1]and matches package names inPI_CODING_AGENT_PACKAGE_NAMES, which includes@oh-my-pi/pi-coding-agent(subagent-runner.ts:44-47). ButresolvePiBinthen only acceptsbin.pi:OMP's package manifest declares
bin: { omp: "dist/cli.js" }— there is nobin.pi— so resolution returnsnullfor a package the resolver just positively identified. The fallback cascade then misses item by item (genericbun.exeruntime → skip; no bundled@earendil-works/pi-coding-agentpeer → skip; nopi/pi.cmdon PATH → miss) and the final fallback spawns bare"pi".Verified against a real OMP 18.1.4 install:
@oh-my-pi/pi-coding-agent/package.json→"bin": {"omp": "dist/cli.js"}.Fix
resolvePiBinaccepts theompbin key afterpi. Pi hosts (manifests withbin.pi) resolve identically; OMP hosts now resolveexecPath + [realpath(dist/cli.js)]— the same "re-invoke the exact host CLI" strategy the resolver already prefers, and cross-platform-safe per the existing design notes (no shell, containment guard, realpath canonicalization all unchanged).Verification
@oh-my-pi/pi-coding-agent,bin: {omp: "dist/cli.js"}), the patchedresolvePiInvocationreturns{command: <bun>, prefixArgs: [<realpath>/dist/cli.js]}and the old code returned the bare-pifallback.bun <OMP>/dist/cli.js --version→omp/18.1.4, exit 0.packages/pi-pluginsuite (915 tests): failure set byte-identical before and after the change (23 pre-existing environment-specific failures on Windows — symlink-creation EPERM in test fixtures and host-PATH leakage — reproduced on pristinemasterand on thev0.41.1tag; the change introduces no new failures).tsc --noEmitclean.Notes
dist/output; a patch release is sufficient for users (no manifest/config changes required).@cortexkit/pi-magic-context), Pi not installed.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by cubic
Fixes Magic Context subagent spawn failures on OMP hosts without a standalone
piinstall.resolvePiBinnow uses OMP’sbin.ompentry instead of falling back to barepi; hosts declaringbin.pibehave unchanged.@oh-my-pi/pi-coding-agent, which declares onlybin.omp.Written for commit 31b7002. Summary will update on new commits.
Greptile Summary
The PR fixes hidden child-agent startup on OMP-only installations by resolving the host CLI from
bin.ompwhile retainingbin.piprecedence and existing path-containment checks.Confidence Score: 5/5
The PR appears safe to merge.
No blocking failure remains.
Important Files Changed
bin.ompas the fallback package-declared CLI afterbin.pi, preserving existing canonicalization and containment validation.dist/cli.jspath through the current runtime.Reviews (2): Last reviewed commit: "test(pi-plugin): cover the bin.omp OMP-h..." | Re-trigger Greptile
Context used: