Repository navigation
Conversation
Embedded hosts (VS Code extensions that host the SDK, embedded web servers) run Pi inside a process whose execPath is the host binary. The resolver classified that as a packaged single-file Pi binary and spawned the editor CLI with Pi flags, so historian, dreamer, recomp, and wrapup all failed with a bad-option exit. Add a user-level pi_binary setting that short-circuits executable detection, wire it into every PiSubagentRunner construction site (live reload included), and append a pi_binary hint when an embedded host is spawned as Pi. Project config cannot set it. Refs cortexkit#851
|
Waiting for This PR needs a linked issue with the |
|
Harness coverage advisory: these conventional twins were not touched:
Cover every shipped harness or explain why the surface does not exist there. See CONTRIBUTING.md. This is advisory only; no draft state is changed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #851
What this changes
pi_binary(user config only) names the Pi executable Magic Context spawns for its child processes. When set,resolvePiInvocationreturns it immediately and skips theargv[1]/execPath/ bundled-package / PATH detection chain. This is the escape hatch for embedded hosts where Pi runs in a process whoseexecPathis the host binary (a VS Code extension hosting the SDK, embedded web servers) — the case in #851 — without changing the default detection order.resolvePiInvocationacceptspiBinary;~/expands, a bare command name stays a PATH lookup, and a path-shaped value that is not a readable file is reported throughfallbackDiagnosticinstead of being spawned blindly.pi_binary.resolveHistorianFromConfig),/ctx-recomp,/ctx-wrapup, and the Dreamer runner factory. It is listed inLIVE_RELOAD_CONFIG_PATHS, so fixing the value applies on the next run without a restart.stripUnsafeProjectConfigFields, the same tier rule asauto_update: a repository must not choose which executable the machine runs.CONFIGURATION.md, and the dashboard coverage manifest regenerated.What this does not change
The default
execPathclassification is untouched. An embedded host that does not setpi_binarystill spawns the host binary as Pi and exits with a bad-option error; that half of #851 is left for maintainers to decide (rename detection, host adapters, or in-process child sessions).Tests
packages/pi-plugin/src/subagent-runner.test.ts: five new cases — short-circuit over an embedded-hostexecPath, unreadable configured path diagnostic,~/expansion, embedded-host failure hint, and no hint for a renamed packaged Pi binary.packages/plugin/src/config/project-security.test.ts: project-config stripping.packages/plugintypecheck andbun test src/config(334 pass, including the live-schema drift check);packages/pi-plugintypecheck,bun test src/config(48 pass),src/subagent-runner.test.ts(168 pass, 2 failures unrelated to this change: this machine's Bun reportsos.userInfo().username === "unknown", so the redaction fixtureunknown-providerbecomes<USER>-provider; Node reportstrim21),src/dreamer+src/index-in-process-latch.test.ts(159 pass); dashboardConfigEditortests (63 pass); biome on the touched files.Harness coverage (required)
resolvePiInvocationpath;pi_binarynames the OMP binary through the shared basename detection.Summary by cubic
Adds a user-level
pi_binaryconfig setting that overrides Pi executable detection, so embedded hosts (VS Code extensions or web servers hosting the SDK) can tell Magic Context which Pi executable to spawn for historian, dreamer, recomp, and wrapup child processes. Without it, those hosts are misdetected as Pi binaries and fail with bad-option exits (#851).pi_binaryskips theexecPath/ bundled-package / PATH detection chain;~/expands, bare command names stay PATH lookups, and unreadable explicit paths surface a fallback diagnostic.pi_binarywhen an embedded host is still spawned as Pi.Bug Fixes
Written for commit 9cca0fa. Summary will update on new commits.