Skip to content

fix(agents): recognize Pi bundled npm entrypoint - #25040

Closed
boris-papevis wants to merge 1 commit into
stablyai:mainfrom
boris-papevis:fix/pi-bundled-entrypoint
Closed

boris-papevis wants to merge 1 commit into
stablyai:mainfrom
boris-papevis:fix/pi-bundled-entrypoint

Conversation

@boris-papevis

Copy link
Copy Markdown
Contributor

ELI5

Pi can launch from dist/bundle/cli.js, but Orca only recognizes its older dist/cli.js path. Accept both so Orca can identify the bundled installation too.

What Changed

Allow optional bundle/ in the shared Pi entrypoint matcher. Keep both supported npm namespaces and the existing package and filename checks.

Extend the tests for both layouts, Windows and POSIX paths, unrelated-script arguments, and Pi/OMP foreground identity.

Why

I found the mismatch while investigating “Send notes” rejecting a running Pi terminal. Fixing the shared matcher covers its existing consumers without bypassing the notes-send checks.

Linked Issue

Fixes #25039

Visual Proof

N/A: no layout or rendering changes. I have not tested notes delivery with a patched Orca build.

Testing

  • The new bundled-path cases fail before the fix and pass afterward (3 failures before, 50 focused tests passing afterward).
  • Reran 8 focused suites on current main: 143 tests passed, including recognition, foreground resolution, terminal-send guards, and notes-send handling.
  • Changed-file lint, formatting, and git diff --check passed.

I ran these on Windows with Node 24.21.0 and the repository's Vitest configuration. The Windows foreground tests use mocked process rows and console membership. The current-base Node typecheck rerun timed out; a local native-dependency rebuild also failed. I have not run a packaged build, native ConPTY/SSH acceptance, or end-to-end notes delivery.

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

AI Disclosure

I used GPT-6.1 Sol to help prepare the patch and tests.

Review

The only production change is the optional path segment. Note formatting, permissions, terminal binding, and delivery are unchanged. This patch does not address Pi headless-mode filtering or separate Windows process-inspection failures.

Agent skill upstream boundary

  • Not applicable; no skill-installer changes.

Notes

Keep support for the old layout and normalized Windows/POSIX paths. Existing local and remote terminal hosts need updated code to use the matcher.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • Visual proof is N/A, with reason above
  • Self-reviewed for correctness, security, and performance
  • Cross-platform and SSH/remote impact considered
  • Full lint, typecheck, test, and build gates pass; CI results pending

@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 — src/shared/agent-node-entrypoint-identities.ts:20 adds an optional (?:bundle\/)? segment to the Pi regex, so both …/@earendil-works|mariozechner/pi-coding-agent/dist/cli.js and …/dist/bundle/cli.js resolve to pi.
  • Shared-recognizer coverage — src/shared/agent-process-recognition.test.ts exercises both layouts across both scopes and POSIX / Windows-unquoted / Windows-quoted command forms, and adds a negative list pinning that the optional segment does not over-match.
  • Windows foreground coverage — src/main/providers/agent-foreground-process-pi.test.ts parameterizes the ConPTY entrypoint and collapsed-OMP anchor cases over both entrypoints.

I verified the underlying claim against the npm registry: @earendil-works/pi-coding-agent moved its bin.pi from dist/cli.js (v0.84.2) to dist/bundle/cli.js (v0.99.0+), so this accepts a real layout and not a hypothetical one. comparablePath() lowercases and normalizes \ to / before matching, so the backslash Windows paths resolve against the forward-slash regex. The change is a single data edit in the shared identity list; every recognizeAgentProcessFromCommandLine consumer inherits it, and no other matcher or code path in the repo hardcodes the legacy Pi entrypoint. Locally, the 50 focused tests pass and oxlint is clean on all three files.

The PR body's caveat — that the matcher fix alone may not restore notes delivery if a separate Windows process-inspection issue exists — is a real open question but is explicitly out of scope for this change.

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

@coderabbitai

coderabbitai Bot commented Oct 3, 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: 44d07c84-a52b-40a7-ba81-3ee40d6f8175
📥 Commits

Reviewing files that changed from the base of the PR and between b601b98 and 13a927b.

📒 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; 9 remain after this review.


📝 Walkthrough

Walkthrough

The Pi identity pattern now accepts both dist/cli.js and dist/bundle/cli.js. Shared tests cover both supported package names, POSIX and Windows command lines, quoted Windows paths, and invalid path or argument cases. Windows foreground tests cover both entrypoints and retain the expected Pi and OMP results.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 13a92

No actionable issue remains in the reviewed change; it is mergeable after normal checks.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 13a92

The change recognizes one additional Pi installation layout while preserving the package-name and filename restrictions. No control bypass was established, but the complete notes-delivery authorization path was not verified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The established exposure change is classification of an additional exact Pi pathname in inspected process command lines. Its known consumers are foreground and terminal-presence decisions; the available evidence does not establish broader service, tenant, credential, or data-store authority.

Security Findings and Attack Paths

  • inferred — Path-based recognition does not authenticate package provenance or bind the script to a trusted installation root. An attacker able to run a script at an accepted pathname could supply a Pi classification. That trust assumption predates this PR for dist/cli.js; the new bundled layout inherits it. Classification alone was not shown to authorize notes delivery, so this is not an established PR-introduced vulnerability.

Trust Boundaries and Controls

  • observed — Inspected terminal-presence and status paths use live PTY or structured-worker state in addition to agent classification. Status queries recheck PTY binding, and exact worker-session resolution requires pane and process-incarnation identity. These controls bound the inspected paths, but do not prove complete notes-send enforcement.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the main change: recognizing Pi's bundled npm entrypoint.
Description check ✅ Passed The description covers the required sections, links issue #25039, explains the change and motivation, and reports testing and its limits. It provides a reason for visual proof being N/A and notes that…
Linked Issues check ✅ Passed Issue #25039 requires recognition of both dist/cli.js and dist/bundle/cli.js for the two supported Pi package scopes. The shared matcher adds optional bundle/ while retaining both scopes and the…
Out of Scope Changes check ✅ Passed The production change and added tests directly support issue #25039. The Windows foreground tests verify the issue's resolver regression scope. No unrelated changes appear in the whole-PR diff.
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…
  • 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.

nwparker pushed a commit that referenced this pull request Oct 4, 2026
Carry the focused patch from boris-papevis/orca PR #25040 onto current main, with independent npm runtime and regression verification.
@nwparker

nwparker commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

The complete patch is now merged in #25290, preserving Borys Papevis’s commit authorship. The successor was verified with real bundled and legacy npm installs, Windows process ownership, passing CI and completed automated reviews. Closing this PR as superseded.

@nwparker nwparker closed this Oct 4, 2026
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.

Pi bundled npm entrypoint is not recognized

2 participants