Skip to content

fix(agents): recognize Pi bundled npm entrypoint (credited successor) - #25290

Merged
nwparker merged 1 commit into
mainfrom
nwparker/pi-low-risk-1004
Oct 4, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/pi-low-risk-1004

Conversation

@nwparker

@nwparker nwparker commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​88 $\color{#cf222e}{\Huge{\mathbf{−}}}$​58 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​30
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 0

ELI5

Orca can miss Pi when npm starts its newer bundled CLI. Accept the exact bundled package path so existing agent recognition and notes-target checks can identify it.

What Changed

Allow one optional bundle/ directory in the canonical Pi Node entrypoint matcher. Preserve both npm namespaces, the older entrypoint, interpreter parsing, package boundaries and filename anchoring. Extend Windows/POSIX path and Pi/OMP foreground tests; unrelated Node arguments stay unidentified.

Why

The npm package @earendil-works/[email protected] declares dist/bundle/cli.js; @mariozechner/[email protected] still declares dist/cli.js. Extending the existing exact matcher fixes its consumers without broad basename matching or bypassing notes delivery guards. This credited current-main successor carries Borys Papevis's complete focused patch from #25040 (head 13a927ba49443025ba616e39054bbed02b9b1557); the original remains untouched.

Linked Issue

Related to #25039 and #25040. No closure requested.

Visual Proof

N/A — no renderer, screen rule, or layout changes. Actual npm process startup identity was measured through macOS ps and the compiled production recognizer: bundled Pi was null before and Pi after, old Pi stayed recognized, and a real unrelated Node server carrying the bundled Pi path as an argument stayed null. Pi later sets its process title to pi on macOS, already recognized on main; this establishes macOS startup identity rather than persistent macOS failure. Native Windows evidence appears below.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated

On macOS with ORCA_BACKGROUND_LAUNCH=1: 141 tests passed across recognition, Windows foreground fixtures, remote evidence, command wrappers, terminal-send and notes-target suites. Restoring main's matcher produced exactly 3 regression failures; restoring the patch passed all 63 directly affected tests. Real npm-installed versions 1.0.2 and 0.73.1 ran in RPC mode with isolated config, no session/extensions/skills or model turn. Their actual startup ps commands were checked against before/after production recognizers, plus a live unrelated Node process negative control.

pnpm tc:node, changed-code quality gate, focused format check, and git diff --check passed. Independent full three-path review passed 161 selected tests on the prospective composition with explicit main ddefd523e052cc83897937569d322a727f55dd78, confirming the full credited feature scope without unrelated main reversions. Hosted CI on unchanged public head 6325dd4c4794a69bf29cadc702bd1f075bf6678d reports 14 successful and 18 skipped contexts, with no failures or pending contexts at the coordinator's check; skips are not executed proof. No packaged Electron build, rendered notes delivery, physical Linux/WSL or SSH reconnect, paid model turn, or TUI readiness is claimed.

Additional actual native Windows x64 (OS version 10.0.26200) proof used npm-installed versions 1.0.2 and 0.73.1, task-owned configuration and Orca's real native process-table reader. Both actual Node entrypoints answered RPC get_state and exited zero without model calls. Production recognition identified the bundled and legacy layouts. The old Pi regex, compared against the canonical parsed entrypoint, returned null for bundled Pi and still matched legacy Pi; this Windows comparator was not a complete mutated baseline recognizer. The macOS before/after proof above used the complete compiled recognizers.

A real unrelated Node script-file process carrying the installed bundled Pi path only as a later argument stayed unidentified. A separate real node -e negative control also stayed null. Exact owned process cleanup was confirmed in fresh native process tables; no unrelated processes were targeted. Both packages declare main: ./dist/index.js, which is irrelevant to the pi bin/recognition rule: “old recognizer returned null” is not a null package-main claim.

Windows verification on pinned ddef matched all three Git index blobs exactly to public head 6325dd4c4794a69bf29cadc702bd1f075bf6678d. 139 Windows tests passed: 63 recognition/foreground tests and 76 process-table/native-addon/Windows-wrapper tests in disjoint files. Node typecheck and changed-file oxlint passed. These are separate from the macOS author 141 and independent 161 cohorts; counts are not added. The setup-added pnpm lockfile modification for observed pnpm 12.8.1 was preserved and excluded from feature scope.

AI Disclosure

The original author disclosed GPT-6.1 Sol assistance; this successor was independently inspected and verified with Codex assistance.

Review

Independent review: CLEAR, whole-PR Low risk, accepted by ROOT on the pinned current-main composition. The public draft head remains unchanged; its public metadata base is b32462f2465c58490af26f49a314d7602578ca8c, separate from that prospective proof. This records a recommendation, not an approval or merge action.

Only production change: an optional path segment in a package-specific anchored regex. No credential/config directory changes, new subprocesses, status producers, wire fields, or notes-send bypasses.

Agent skill upstream boundary

  • Not applicable; no skill-installer changes.

Notes

Execution hosts need the updated matcher; an old remote host retains old recognition. No wire shape or identity vocabulary changes. Folder workspaces and git worktrees share this recognizer. Known separate product risk: current Pi recognition does not filter print/RPC modes; that already exists for older Pi entrypoints and is not repaired here. No TUI readiness or completed model-turn claim is made.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • Visual proof is N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform and SSH/remote impact considered
  • Independent full three-path review and focused local checks passed
  • Exact public-head hosted CI reported with honest skips
  • Full local lint/build and additional platform journeys are not claimed

Carry the focused patch from boris-papevis/orca PR #25040 onto current main, with independent npm runtime and regression verification.
@nwparker
nwparker marked this pull request as ready for review October 4, 2026 21:10
@coderabbitai

coderabbitai Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

🧰 Additional context used
📚 Code guidelines (1)
AGENTS.md — auto-discovered

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3942ddde-0e65-4753-bbce-aff9ba2cfee6
📥 Commits

Reviewing files that changed from the base of the PR and between b32462f and 6325dd4.

📒 Files selected for processing (3)
  • src/main/providers/agent-foreground-process-pi.test.ts
  • src/shared/agent-node-entrypoint-identities.ts
  • src/shared/agent-process-recognition.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

The Pi entrypoint pattern now matches cli.js under both dist and dist/bundle. Shared tests cover both package scopes, POSIX and Windows command forms, and invalid matches. Windows foreground tests cover both entrypoints and retain the existing Pi PID and OMP anchoring assertions.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 6325d

Pi processes using the bundled entrypoint can now be recognized alongside legacy installs. The supplied tests cover the supported command forms and foreground behavior, and no material merge risk is evident.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 6325d

The change narrowly expands Pi recognition while retaining package-path restrictions, terminal-ownership checks, and guarded notes delivery. No control bypass was identified. Recovery and concurrent delivery for the newly recognized layout were not fully verified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The demonstrated exposure expansion is classification of bundled Pi processes within existing terminal foreground resolution. The downstream sensitive outcome is delivery of notes to a selected terminal; broader service, tenant, or environment authority was not established.

Trust Boundaries and Controls

  • observed — Command-line recognition selects the interpreter entrypoint before applying the matcher. Existing negative cases reject malformed package paths and matching Pi paths supplied only as unrelated arguments, limiting argument-based identity spoofing.
  • observed — Guarded notes delivery requests sendable-agent checks for both paste and submission. Runtime enforcement checks exact live terminal-to-PTY binding and input locks, rejects permission or absent-agent states, and passes the precondition callback into the write path.

Resilience and Maintainability Implications

  • observed — The existing paste-and-submit transition rechecks readiness after paste and reports partial submission failure when readiness is lost or submission is refused. This represents interruption explicitly rather than treating successful recognition or paste as completed delivery; it does not establish automatic rollback or retry idempotency.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the Pi bundled npm entrypoint recognition fix. The parenthetical is extra but does not obscure the main change.
Description check ✅ Passed The description covers the template’s required sections, explains the change and rationale, links related issues, and gives detailed testing evidence and limitations. It marks visual proof as not appl…
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 3…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • Recognize Pi's bundled npm entrypoint — the package-anchored pi Node-entrypoint pattern in src/shared/agent-node-entrypoint-identities.ts:20 gains one optional segment (dist/(?:bundle/)?cli.js), covering @earendil-works/[email protected]'s dist/bundle/cli.js while keeping the legacy dist/cli.js and both npm scopes working.
  • Recognition tests parameterized — src/shared/agent-process-recognition.test.ts now exercises both scopes and both entrypoints across POSIX, Windows, and quoted spaced-Windows paths, and adds a negative table (no node_modules, wrong scope/package, notnode_modules, trailing .extra, bundle/nested/, and Pi path present only as a later argv/--require/--eval argument).
  • ConPTY foreground tests parameterized — src/main/providers/agent-foreground-process-pi.test.ts runs its two Windows foreground cases for cli.js and bundle\cli.js.

I confirmed the load-bearing path against the real registry: @earendil-works/[email protected] declares "bin": { "pi": "dist/bundle/cli.js" }. The negative cases are genuine guards rather than theatre — a looser matcher (dropping the $ anchor or allowing a nested segment) would fail them. I found no other hardcoded pi-coding-agent/dist/cli.js matcher in src/main or src/shared; consumers resolve through this shared recognizer, so the single-line regex is the whole change. Ran both affected suites: 63 tests pass.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@nwparker
nwparker merged commit ca77409 into main Oct 4, 2026
64 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants