Skip to content

fix(skills): pin the skills package spec so npx cannot run a PATH collision - #18867

Closed
AntonioKL wants to merge 2 commits into
stablyai:mainfrom
AntonioKL:fix/skills-npx-package-pinning
Closed

AntonioKL wants to merge 2 commits into
stablyai:mainfrom
AntonioKL:fix/skills-npx-package-pinning

Conversation

@AntonioKL

Copy link
Copy Markdown
Contributor

ELI5

Orca installs skills by running npx --yes skills add …. npx looks for a program called skills on your PATH first, and only fetches from the npm registry if it does not find one. So on a machine that has some other program named skills, Orca was politely handing its arguments to a stranger. The error looked like Orca passing a bad flag. Adding a version to the name (skills@latest) makes npx fetch the package we actually mean.

What Changed

New SKILLS_CLI_PACKAGE_SPEC = 'skills@latest' in src/shared/agent-feature-install-commands.ts, used as the package argument by every path that builds the command:

  • buildAgentFeatureSkillInstallArgs / buildAgentFeatureSkillUpdateArgs — the shared builders behind Settings, onboarding, and orca skills install|update.
  • buildTargetedSkillUpdateCommand (src/shared/skill-freshness.ts) — the terminal-fallback command.
  • SkillUpdateRunner (src/main/skills/skill-update-run.ts) — the headless update spawn.

Two regexes in CliSkillRuntimeSetup.tsx re-parse a command Orca generated, so they now accept the spec (skills(?:@\S+)?). The CLI help text for orca skills install|update and the runnable commands in the CLI docs are pinned to match what Orca now runs.

The rest of the diff is test expectations: these commands are asserted as literal strings in a lot of places.

Why

--yes is often misread as "always fetch". It only suppresses the install prompt. For a bare name, npx checks node_modules/.bin and then PATH and executes any match without consulting the registry. Only a version or tag spec makes npx treat the argument as a package to fetch.

The reporter's host had Headlong's skills binary at ~/.local/bin/skills, with ~/.local/bin third on PATH:

bare npx  -> skills 0.1.0     # the wrong program
pinned    -> 1.5.23           # npx --yes skills@latest --version

and the resulting failure reads like an Orca bug:

$ orca skills update --skill orchestration
Running: npx --yes skills update orchestration --global -y
skills: error: Unknown option: --global (try skills --help)

Removing the colliding binary is not always available as a workaround — in that case Headlong invokes bare skills prompt at every agent wake, so it legitimately needs that name on PATH.

More broadly: a control plane that runs npx <bare-name> on hosts it orchestrates is trusting an unowned name in a global namespace. That is worth closing on its own, separately from this particular collision.

skills@latest rather than the -p skills@latest skills … form the issue also offered: the npm package publishes bin: { skills, add-skill }, so a bin matches the package name and npx skills@latest resolves it unambiguously. The -p form adds two tokens to a command that also has to survive cmd.exe wrapping and the WSL login-shell path, for no additional guarantee here.

Distinct from #13807, which is about resolving the npx binary to a dead version-manager shim. This one is npx running correctly and then resolving the package name to the wrong program.

Linked Issue

Fixes #18687

Visual Proof

N/A — no UI layout or styling change. The only user-visible difference is the command text shown in Settings / --dry-run output, which now reads npx skills@latest add …. The behavior is a command-construction change, pinned by tests:

before after
generated install npx --yes skills add … npx --yes skills@latest add …
host with a colliding skills on PATH runs that program runs the npm package
host without one runs the npm package unchanged

Testing

New regression test in src/shared/agent-feature-install-commands.test.ts — always pins a version spec so npx cannot resolve a PATH collision — asserts the spec is shaped skills@<something> and that the first argument of every generated arg list is that spec and not the bare skills, across install/update and both scopes, plus the terminal-fallback command. It fails if any future builder reverts to a bare name.

Existing tests that assert the literal command were updated rather than loosened, so the exact string a user sees stays pinned. Two array-form expectations now reference SKILLS_CLI_PACKAGE_SPEC directly so they cannot drift from the source.

Ran on macOS: src/shared/, src/cli/, src/main/skills/, src/main/telemetry/, and the renderer settings / skills / onboarding / sidebar suites — 1353 files, 12,772 tests, all passing, plus pnpm tc and pnpm run check:code-quality:changed. CI covers the full pnpm test and pnpm build.

Also confirmed the package identity directly rather than assuming it: npm view skills reports 1.5.23, bin = { skills, add-skill }, repository git+https://github.com/vercel-labs/skills.git.

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

AI Disclosure

Written with Claude Code (Claude Opus 5). The call sites were traced from the shared builder outward; the fix, tests, and this description were authored in that session and reviewed by me.

Review

  • Cross-platform (macOS / Linux / Windows): the spec is one more argv token, so the Windows getSpawnArgsForWindows / cmd.exe rail and the WSL login-shell path carry it unchanged; both have tests that now assert the pinned form. @ is not special to cmd.exe argument parsing and the token is never free text.
  • Remote / SSH: the same generated command is what a remote/WSL setup terminal runs, so remote hosts get the same protection. No RPC params, stream frames, or published content change — no wire-compatibility surface.
  • Mobile: not affected.
  • Performance: @latest makes npx re-check the registry rather than reuse a globally installed binary. See Notes — this is the real trade and it is deliberate.
  • Security: this is the point of the change. It removes an unowned global name from Orca's trusted execution path on every host it orchestrates.
  • Backwards compatibility: no persisted state, settings, or schema changes. Commands users have already copied still work; they are simply still exposed to the collision.

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

The trade, stated plainly. @latest costs an npm registry check that a bare name could sometimes skip by reusing an already-installed skills on PATH — which is exactly the resolution this PR is removing, so the two cannot be had at once. npx still caches, so the cost is a metadata check rather than a re-download, but a fully offline host that previously succeeded via a globally installed skills will now fail. An exact pin ([email protected]) would be cacheable and fully deterministic at the cost of freezing users on a version Orca has to bump; @latest matches what the reporter proposed and verified. Happy to switch to an exact pin with a renovate-style bump if maintainers prefer that.

Not in this PR — the two follow-ons the issue raises, both worth their own change:

  • Verify the CLI that actually executed is the expected one (parse --version) and report the resolved path when it is not, so a future collision names itself instead of surfacing as Unknown option: --global.
  • orca skills update <name> on a skill present in an agent home but absent from the CLI's registry reports No installed skills found matching: <name> with no hint that orca skills install is the fix.

Prose and search-keyword mentions of npx skills add in the docs were left as-is; only runnable commands were pinned.

Author: @AntonioKL

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

…lision

npx resolves a bare package name from node_modules/.bin and then PATH
before it will consult the registry, so on a host with any unrelated
executable named `skills` on PATH, `npx --yes skills add ...` silently
handed Orca's arguments to that other program. The failure surfaced as
`skills: error: Unknown option: --global`, which reads like an Orca bug.
--yes only suppresses the install prompt; it does not force registry
resolution. Only a version spec does.

Adds SKILLS_CLI_PACKAGE_SPEC ('skills@latest') and routes every generated
command through it: the shared install/update arg builders, the headless
update runner, and the terminal-fallback command. The two regexes that
re-parse a generated command now tolerate the spec, and the docs commands
users copy are pinned the same way.

The npm package publishes a `skills` bin matching its own name, so the
spec alone resolves the intended binary.

@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

The fix is correct and complete: pinning skills@latest makes npx treat the argument as a package to fetch rather than a name to resolve against PATH, closing the #18687 collision.

  • SKILLS_CLI_PACKAGE_SPEC = 'skills@latest' — new shared constant used as the leading argv token by every command builder, so a future bare-name revert is a one-token drift the regression test catches.
  • Builders + headless runner — buildAgentFeatureSkillInstallArgs / buildAgentFeatureSkillUpdateArgs, buildTargetedSkillUpdateCommand, and SkillUpdateRunner all now emit the spec; I traced every runnable call site (CLI buildNpxSkillsArgs, the renderer re-export, linear-agent-skill-update-command.ts) and all flow through the shared constants.
  • CliSkillRuntimeSetup regexes — the two re-parsers now accept skills(?:@\S+)?; correct, and @ is not in WINDOWS_BATCH_UNSAFE_CHARACTERS, so the cmd.exe rail and WSL login-shell path carry it unchanged (asserted by tests).
  • Test updates — literal-string expectations tightened rather than loosened, and the new regression test fails if any builder reverts to a bare name.

ℹ️ @latest re-binds installs to the registry and couples Orca to the skills CLI's flag surface

This is the one real trade to weigh, and it's a product decision rather than a defect — the code is correct as written. The skills package is a third-party CLI whose flags Orca hardcodes (add, update, --global, --project, --skill, --agent, -y), and @latest means an upstream release can rename a flag and break Orca's install/update flows with no Orca change. It also reintroduces a registry metadata check on every run, so a fully-offline host that previously succeeded by reusing an npm-globally-installed skills will now fail. The author already surfaced this and offered an exact pin ([email protected]) with a renovate-style bump, which removes both risks at the cost of a manual version bump.

Technical details
# `@latest` vs an exact pin

## Affected sites
- `src/shared/agent-feature-install-commands.ts:9` — `SKILLS_CLI_PACKAGE_SPEC = 'skills@latest'`; the single source every builder and runner consumes.

## Required outcome
- Maintainers should consciously decide whether the offline-host regression and upstream flag-coupling are acceptable, or whether an exact pin with a scheduled bump is preferred.

## Open questions for the human (optional)
- Is there an air-gapped/offline install story for skills that a registry check would break?
- Does the team want a renovate-style dependency bump for `skills` (exact pin), or is floating `latest` acceptable?

ℹ️ Nitpicks

  • docs/reference/headless-linux-server.md:880,908 and docs/site/content/docs/cli/reference.mdx:299 still describe the resolved command as npx skills add <repo> ... / npx skills update <names...> — e.g. "This resolves the same npx skills add <repo> --skill <name> ... command Settings would show you." That claim is now slightly inaccurate since Settings emits skills@latest. These are prose with placeholders (not runnable commands), so it's cosmetic, but they assert an exact match that no longer holds.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@coderabbitai

coderabbitai Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 48b9bd94-9016-4eb6-8806-adc3342a521e

📥 Commits

Reviewing files that changed from the base of the PR and between c7a396f and e880143.

📒 Files selected for processing (2)
  • docs/reference/headless-linux-server.md
  • docs/site/content/docs/cli/reference.mdx

Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review.


📝 Walkthrough

Walkthrough

Skill installation and update commands now use npx skills@latest. Shared command builders provide the package specification through SKILLS_CLI_PACKAGE_SPEC. Background update execution and Windows command handling support versioned commands. CLI, onboarding, settings, freshness, telemetry, and documentation tests now expect the new command format.

Merge Risk: ⚪ Minimal · up to e8801

Skills install and update guidance now consistently names the intended npm package version tag. No current merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 26 files. (2 skipped: 2… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary change: pinning the Skills package specification to prevent PATH collisions.
Description check ✅ Passed The description follows the repository template and includes the change, rationale, linked issue, visual proof, testing, AI disclosure, compatibility review, scope notes, and checklist.
Linked Issues check ✅ Passed The implementation satisfies issue #18687 by using skills@latest across shared command builders, CLI and Settings flows, fallback updates, documentation, parsing logic, and tests.
Out of Scope Changes check ✅ Passed The changes remain focused on preventing bare skills package resolution. Documentation, regex updates, production code, and test updates directly support the linked issue.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 26 files. (2 skipped: 2 unsupported.)

  • Fix all pre-merge checks with AI

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.

The prose asserted an exact match with the command Settings emits, which
now carries the pinned package spec.

@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

The follow-up commit addresses the prior review's nitpick by correcting the docs prose that asserted an exact match with the command Settings emits. Every flagged spot now carries the pinned skills@latest spec.

  • docs/reference/headless-linux-server.md — the three prose spots (npx skills add ... --global, npx skills add <repo> --skill <name> ..., npx skills update <names...>) now read npx skills@latest ..., matching what Settings actually emits.
  • docs/site/content/docs/cli/reference.mdx — the "shell out to the same ... commands Settings uses" line now reads npx skills@latest.

This fully resolves the ℹ️ Nitpicks from the prior review. The remaining bare npx skills add references in the docs are frontmatter search keywords and generic prose that describe the conceptual action rather than asserting a byte-for-byte match with Orca's generated command, so leaving them is the documented intent.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@nwparker

Copy link
Copy Markdown
Contributor

Thanks for tracking this down so precisely, @AntonioKL. The npx PATH-lookup explanation was really helpful. This is already fixed on main by #27603 (83056e5). Every npx command Orca builds now uses an exact version spec, skills@${SKILLS_CLI_VERSION} (currently [email protected], in src/shared/agent-feature-install-commands.ts), so npx always fetches the real package and never runs a different skills binary on PATH. Separately, #30185 moved orca skills install|update over to a bundled installer, so those commands no longer shell out to npx at all.

If you still hit the colliding binary on the latest build, please comment or reopen and we'll take another look.

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

[Bug]: orca skills install/update runs npx skills with a bare name, so any unrelated skills binary on PATH shadows the npm package

2 participants