Skip to content

fix(settings): guide Windows skill setup when npx is missing - #10453

Merged
brennanb2025 merged 9 commits into
stablyai:mainfrom
0bkevin:fix/windows-skill-install-npx-prerequisite
Jul 29, 2026
Merged

brennanb2025 merged 9 commits into
stablyai:mainfrom
0bkevin:fix/windows-skill-install-npx-prerequisite

Conversation

@0bkevin

@0bkevin 0bkevin commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #10438.

Windows skill setup currently opens a terminal with an npx skills command even when npx is unavailable. PowerShell then reports a generic CommandNotFoundException, leaving users without a recovery path.

This change:

  • checks for npx.cmd before native Windows skill install and update commands
  • prints actionable Node.js LTS, PATH, and restart guidance when it is missing
  • executes the exact npx.cmd shim found by the prerequisite check
  • routes the feature-tip and mobile-emulator setup terminals through the existing runtime-aware command builder
  • preserves existing WSL, macOS, Linux, and unrelated-command behavior

Screenshots

No visual change.

The command behavior was validated on a Windows machine with both missing and installed npx. I would appreciate additional Windows users validating the full interactive setup flow through Orca as well.

Testing

  • pnpm lint
  • pnpm typecheck
  • pnpm test — the full run reached 35,652 passing and 62 skipped tests. Two affected settings expectations were corrected and now pass; five unrelated timing-sensitive failures passed in isolation. One untouched release-package contract test remains inconsistent with the current upstream release workflow.
  • pnpm build
  • Added or updated high-quality tests that would catch regressions

Additional validation:

  • Focused runtime and call-site tests: 22/22 passed.
  • Changed-file Oxlint, React Doctor, Oxfmt, and git diff --check passed.
  • Mobile TypeScript, lint, formatting, and tests passed: 2,451 passed and two skipped.
  • Expo Android prebuild and Gradle assembleRelease passed: 987 tasks completed.
  • On Windows PowerShell 5.1, the exact generated command printed the expected recovery guidance and returned exit code 1 when npx.cmd was absent.
  • After installing Node.js LTS, the same command resolved and launched the real C:\Program Files\nodejs\npx.cmd shim.

AI Review Report

The review traced every changed skill-install surface and the shared runtime command builder. It explicitly checked native Windows host execution, the missing-runtime Windows fallback, WSL distro selection, non-Windows hosts, and unrelated commands.

The review flagged that checking bare npx could resolve a different PowerShell shim than the command eventually executed. The implementation now checks and runs npx.cmd consistently behind a cmd.exe boundary that is valid from PowerShell, Command Prompt, and Git Bash.

It also found setup surfaces that bypassed the runtime-aware builder. The feature-tip and mobile-emulator terminals now use that builder and propagate the selected terminal shell. Regression tests guard those call sites.

Cross-platform review covered macOS, Linux, Windows, WSL, local terminals, SSH behavior, paths, shell parsing, and Electron renderer platform detection. The new branch is restricted to native Windows; WSL and non-Windows commands retain their previous forms.

Security Audit

The wrapper applies only to known npx skills add and npx skills update commands produced by Orca. The command is not constructed from user input.

No new IPC, authentication, credentials, dependencies, filesystem writes, or network APIs are introduced. The review checked command quoting and shell metacharacter boundaries across PowerShell, Command Prompt, and Git Bash. WSL commands remain inside their selected distro and are not routed through the Windows host prerequisite.

Notes

  • No documentation update is required; this restores a recoverable setup path rather than introducing a new workflow.
  • Additional interactive verification from Windows users would be welcome.
  • X: @0bkevin

ELI5

On Windows, skill setup ran npx even when Node was missing, so PowerShell only showed a cryptic command-not-found error. Now Orca checks for npx first and tells you how to install Node and fix PATH if it is missing.

@coderabbitai

coderabbitai Bot commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Skill installation commands are now generated from the active project skill runtime in emulator setup and feature-tip terminals. Windows skill add and update commands receive an npx availability preflight with installation guidance, while WSL, non-Windows, remote-runtime, and unrelated commands retain direct execution. Terminal components receive runtime-specific shell overrides. Tests cover Windows, WSL, missing-runtime, non-Windows, shell selection, and caller wiring behavior.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 11.11% which is insufficient. The required threshold is 80.00%. 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 main Windows npx-missing fix.
Description check ✅ Passed The description directly matches the implemented Windows npx prerequisite and guidance changes.
Linked Issues check ✅ Passed The PR addresses #10438 by detecting missing npx on Windows and providing actionable recovery guidance.
Out of Scope Changes check ✅ Passed The added shell-override plumbing and test coverage stay aligned with the Windows skill setup fix.

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.

@coderabbitai coderabbitai 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.

🧹 Nitpick comments (1)
src/renderer/src/components/settings/agent-skill-installed-command-callers.test.ts (1)

71-75: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Cover the mobile terminal shell override.

Add terminalShellOverride={activeSkillRuntime.terminalShellOverride} to this caller contract; otherwise removing the new emulator shell routing still passes this regression test.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0bf04f17-8e23-4c4a-badf-764585c7b358

📥 Commits

Reviewing files that changed from the base of the PR and between b600e25 and 7aa6252.

📒 Files selected for processing (6)
  • src/renderer/src/components/emulator-pane/MobileEmulatorAgentSetupGuideSteps.tsx
  • src/renderer/src/components/feature-tips/CliSkillSetupTerminal.tsx
  • src/renderer/src/components/settings/CliSkillRuntimeSetup.test.tsx
  • src/renderer/src/components/settings/CliSkillRuntimeSetup.tsx
  • src/renderer/src/components/settings/OrchestrationPane.test.tsx
  • src/renderer/src/components/settings/agent-skill-installed-command-callers.test.ts

@nwparker nwparker added the bug Something isn't working label Jul 27, 2026
…X shells

Review fixes on the Windows npx preflight:

- Probe and run bare `npx` instead of pinning `npx.cmd`. cmd.exe resolves both
  through PATHEXT, so shims that ship `npx.exe` (Volta) no longer get told
  "npx was not found" on a machine where npx works.
- Force the skill terminal to PowerShell when the configured Windows shell is
  POSIX-family. Git Bash rewrites the leading `/d /s /c` arguments as MSYS
  paths, which would break a command that runs fine there today.
- Drop the "restart Orca" advice. Every new PTY merges the persisted Windows
  PATH, so a new setup terminal already picks up a fresh Node install.
- Fall back to the plain command on the two newly routed call sites when the
  project runtime is repair-required, matching the eight existing callers.
  Those sites otherwise emitted a wsl.exe command for a missing distro.

Adds coverage for the Git Bash override and for cmd.exe block safety.
…ed path

The Windows npx wrapper is emitted whenever buildSkillCommandForRuntime falls
back to the local host, but three paths never consulted the shell override, so
a Git Bash user still got the cmd.exe string pasted into MSYS:

- useActiveProjectSkillRuntime returned an empty result whenever no local
  project runtime resolved (no repo yet, or an SSH/remote repo) while the
  command builder kept wrapping. It now resolves the override for that same
  host fallback, so the wrap gate and the shell gate agree.
- The Linear setup prompt carried a third copy of the override that was still
  on the old wsl.exe-only check. It now delegates, as does the settings copy,
  leaving one implementation.
- MobileEmulatorAgentControlRow built wrapped commands but passed no override.

Also drops the unreachable WSL guard inside the wrapper; the only caller is
already on the non-WSL branch.
…the emulator row

- Skill setup terminals spawn on the focused runtime environment, so a Windows
  client was handing a cmd.exe command to a remote Linux host where the plain
  npx command used to run. Skip the wrapper whenever a runtime environment is
  focused.
- MobileEmulatorAgentControlRow was left half routed: it took the project
  runtime's shell override while still building a Windows host command, so a
  WSL project got the cmd.exe wrapper inside a WSL shell. Build its commands
  from the same runtime, matching MobileEmulatorAgentSetupGuideSteps.
- The remote check used settings.activeRuntimeEnvironmentId, but the setup
  terminal routes through getSingleFocusedRuntimeEnvironmentId, which keeps the
  terminal local unless exactly one saved environment is focused. Users with
  two or more environments lost the preflight while still running locally.
- LinearAgentSkillPane memoized its commands on the project runtime alone. The
  built command now also depends on the focused runtime environment, and
  Settings panes stay mounted, so the memo could serve a stale Windows command
  after a runtime switch. Compute it inline like every sibling pane.
…ooks

The mobile emulator surfaces detect the Orca CLI skill with a local-host scan
that takes no discovery target, so building their commands from the project
runtime made a WSL project install into the distro while detection kept
scanning Windows: the panel stayed "Not installed" with no way out. Build host
commands there again, as the surrounding comment already documented, and keep
only the terminal shell override those surfaces actually needed.

Also narrow the remote check back to the focused environment id. Matching the
terminal router exactly meant reading runtimeEnvironments, which nothing on
these surfaces subscribes to, so adding or removing an environment mid-session
could leave a stale decision. The focused id alone over-skips instead, which
degrades to the previous behavior rather than sending cmd.exe to a remote host.
…back

installDisabledReason is only ever set on Windows, so dropping the whole
command builder on that branch stripped the npx preflight exactly where it is
needed. This terminal auto-pastes with no install gate, so that fallback put
the bare npx command straight back in front of the user stablyai#10438 describes. Drop
to the host runtime instead, which still avoids the missing WSL distro.

Pins the two call-site invariants that were unguarded: the emulator surfaces
must build host commands because their detection scans the host only, and the
Linear prompt's shell override must cover POSIX-family Windows shells.
This pane was the only one of eight requiring a resolved project runtime
before building its command, so a Windows user with no repo added yet — the
state issue stablyai#10438 was reported from — got the bare npx command and the same
dead end. An absent runtime already resolves to the local host, which is what
the sibling panes rely on.

Also pins the repair-required host fallback added in the previous commit; the
existing assertions all passed against the old form.
Reverting the previous commit left the whole suite green, and this is a PR
where several regressions came from an earlier fix, so guard it the same way
the emulator call sites are guarded.
@brennanb2025

Copy link
Copy Markdown
Contributor

Thanks for this — the diagnosis is right and the approach holds up. Checking and then running the same npx behind one cmd.exe boundary is the correct shape, and the ordering after normalizeWindowsSkillUpdateCommand is right.

I reviewed it against current main and pushed eight follow-up commits. The substantive ones:

  • where.exe npx instead of where.exe npx.cmd, and bare npx in the else branch. Pinning .cmd told users with an npx.exe shim (Volta) that "npx was not found" on a machine where npx works — worse than the original bug. Because both the probe and the execution sit inside cmd.exe, PATHEXT resolves them identically, so this keeps the invariant you wanted without the false negative.
  • Git Bash. git-bash is a supported terminalWindowsShell and MSYS rewrites the leading /d /s /c as paths, so the wrapper broke a flow that works today. The skill terminal now forces PowerShell whenever the configured shell is POSIX-family, reusing resolveWindowsShellStartupFamily. That override lived in three near-identical copies; they now share one implementation, which is what let two of them drift out of sync in the first place.
  • Dropped the "restart Orca" guidance. mergePersistedWindowsPath re-reads the registry PATH into every new PTY, so a new setup terminal already picks up a fresh Node install.
  • Remote runtimes. Setup terminals spawn on the focused runtime environment, so a Windows client was handing a cmd.exe command to a remote Linux host. The wrapper is now skipped there.
  • Reverted the emulator surfaces to host-built commands. Routing them through the project runtime made a WSL project install into the distro while use-mobile-emulator-agent-setup-state still scans the Windows host, leaving the panel stuck on "Not installed" with no way out. Their local-only detection is the constraint the existing comment already documented.
  • EphemeralVmsPane required a resolved project runtime before building its command, so a Windows user with no repo added yet — the state this issue was reported from — still got the bare command.

On testing: CI had no evidence beyond track-community-pr, so I verified locally. Typecheck, oxlint and oxfmt are clean, and 764 renderer test files / 6577 tests pass. I mutation-checked each new assertion — every one fails when its fix is reverted. I also validated in a real Electron build on macOS that all six skill-setup surfaces still emit the plain command with no wrapper, and confirmed in the live renderer that forcing win32 does produce it, so the path is wired rather than dead.

Two things I did not change, worth calling out:

  • The onboarding and feature-wall surfaces (onboarding-feature-setup.ts → FeatureSetupInlineTerminal) still emit a raw npx skills add with no preflight. That is plausibly where the reporter hit this, so this PR narrows the issue rather than fully closing it. Worth a follow-up.
  • On Windows the displayed and copied command is now the full wrapper. That is a real UX cost, and the copied string no longer works if pasted into Git Bash or WSL by hand. Longer term, an IPC prerequisite check (isCommandOnPath) would cover macOS, Linux and WSL too and keep the visible command readable — but that is a bigger change than this fix should carry.

The npx skills add|update gate still matches after -y is appended, so this composes with the change landing in #9567.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7a5d447b-f4ce-486f-b385-86fc641da62f

📥 Commits

Reviewing files that changed from the base of the PR and between 7aa6252 and 34a1ac4.

📒 Files selected for processing (15)
  • src/renderer/src/components/emulator-pane/MobileEmulatorAgentSetupGuideSteps.tsx
  • src/renderer/src/components/feature-tips/CliSkillSetupTerminal.tsx
  • src/renderer/src/components/settings/CliSkillRuntimeSetup.test.tsx
  • src/renderer/src/components/settings/CliSkillRuntimeSetup.tsx
  • src/renderer/src/components/settings/EphemeralVmsPane.tsx
  • src/renderer/src/components/settings/LinearAgentSkillPane.tsx
  • src/renderer/src/components/settings/MobileEmulatorAgentControlRow.tsx
  • src/renderer/src/components/settings/OrchestrationPane.test.tsx
  • src/renderer/src/components/settings/agent-skill-installed-command-callers.test.ts
  • src/renderer/src/components/sidebar/linear-agent-skill-runtime.shell-override.test.ts
  • src/renderer/src/components/sidebar/linear-agent-skill-runtime.ts
  • src/renderer/src/hooks/useActiveProjectSkillRuntime.test.tsx
  • src/renderer/src/hooks/useActiveProjectSkillRuntime.ts
  • src/renderer/src/lib/project-skill-runtime.test.ts
  • src/renderer/src/lib/project-skill-runtime.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/renderer/src/components/feature-tips/CliSkillSetupTerminal.tsx
  • src/renderer/src/components/emulator-pane/MobileEmulatorAgentSetupGuideSteps.tsx
  • src/renderer/src/components/settings/OrchestrationPane.test.tsx

Comment on lines +144 to +145
const missingNpxGuidance =
'echo ERROR: npx was not found. Install Node.js LTS from https://nodejs.org/ to get npx. & echo Then close this terminal and start skill setup again - a new terminal picks up the updated PATH. & exit /b 1'

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.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Localize the terminal guidance.

This terminal-visible recovery text is hardcoded English. Route it through the locale catalog while preserving cmd-safe escaping for the emitted command. Based on learnings, settings user-facing strings require locale keys and catalog propagation.

Source: Learnings

Comment on lines +152 to +158
function isRemoteRuntimeEnvironmentFocused(): boolean {
// Why: the terminal router also weighs how many environments are saved, but
// that slice has no subscriber here. Read only the focused id, which every
// caller re-renders on: it over-skips rather than ever handing a cmd.exe
// command to a remote shell.
return Boolean(useAppStore.getState().settings?.activeRuntimeEnvironmentId?.trim())
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Function name over-promises its scope

isRemoteRuntimeEnvironmentFocused returns true whenever activeRuntimeEnvironmentId is any non-empty string, which includes locally-saved runtime environments, not only remote ones. A Windows user who has saved a local runtime environment (with a non-empty ID) and focused it will skip the npx preflight and fall back to the cryptic CommandNotFoundException — the exact problem this PR is fixing.

The comment inside the function documents the intentional over-skip, but the name misleads callers into thinking the guard is tighter than it is. Consider renaming to something like isNonDefaultRuntimeEnvironmentFocused or isNamedRuntimeEnvironmentFocused to signal that any saved/named environment triggers the bypass, not exclusively remote ones.

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!

Comment on lines +144 to +149
const missingNpxGuidance =
'echo ERROR: npx was not found. Install Node.js LTS from https://nodejs.org/ to get npx. & echo Then close this terminal and start skill setup again - a new terminal picks up the updated PATH. & exit /b 1'
// Why: cmd.exe is one shell-neutral boundary for PowerShell and Command
// Prompt, and it resolves the bare name through PATHEXT for both the
// preflight and the executed command, so shims such as npx.exe still count.
return `cmd.exe /d /s /c "where.exe npx >nul 2>nul & if errorlevel 1 (${missingNpxGuidance}) else (${trimmedCommand})"`

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Guidance text assumes a generic terminal restart, but the feature-tip terminal auto-pastes

CliSkillSetupTerminal is the one caller that auto-pastes the command with no install gate. If a user follows this guidance, installs Node.js, and then closes the terminal widget, the new PATH won't be visible in the already-open Orca renderer process. "Close this terminal and start skill setup again" may not be sufficient — the user may need to fully restart Orca (or at least close and reopen the feature-tip panel) for the renderer's window.api.platform environment to pick up the updated PATH. The guidance could call out that Orca itself must be restarted, not just the embedded terminal pane, so users don't retry in the same session and remain confused.

@greptile-apps

greptile-apps Bot commented Jul 29, 2026

Copy link
Copy Markdown

Greptile Summary

This PR fixes a poor Windows UX where the skill setup terminal would run npx even when Node.js was not installed, producing an unhelpful CommandNotFoundException with no recovery path. It adds a cmd.exe-based npx preflight that prints actionable Node.js installation guidance when npx is absent, and routes the feature-tip and mobile-emulator setup terminals through the existing runtime-aware command builder so they receive the correct shell override (PowerShell) when Git Bash or WSL is the configured Windows terminal.

  • New npx preflight wrapper in CliSkillRuntimeSetup.tsx: wraps npx skills add/update commands with cmd.exe /d /s /c "where.exe npx >nul 2>nul & if errorlevel 1 (guidance) else (command)", skipped for WSL runtimes and remote runtime environments.
  • Shell override now propagated when no project runtime resolves: useActiveProjectSkillRuntime previously returned a bare EMPTY_ACTIVE_PROJECT_SKILL_RUNTIME when no project was detected; it now computes terminalShellOverride so that the cmd.exe wrapper command is opened in PowerShell rather than Git Bash.
  • getAgentSkillTerminalShellOverride / getLinearPromptTerminalShellOverride refactored into a shared helper in project-skill-runtime.ts, and now correctly forces PowerShell for any POSIX-family Windows shell (Git Bash and wsl.exe), not only wsl.exe.

Confidence Score: 4/5

The change is well-scoped: the new cmd.exe wrapper only applies to known static npx skills add/update commands, WSL paths are untouched, non-Windows platforms are unreachable by the new branch, and the escape-safety test explicitly guards against cmd.exe metacharacter injection.

The implementation is thorough and the new code paths are well-tested (22 focused tests, metacharacter safety assertions, remote-env bypass verification). Two P2 findings: isRemoteRuntimeEnvironmentFocused will silently skip the npx preflight for Windows users with any locally-saved runtime environment ID, and the recovery message tells users to close the terminal when the Orca process itself may need a restart for PATH changes to take effect in the renderer. Neither blocks the primary fix from working in the common case.

Files Needing Attention: CliSkillRuntimeSetup.tsx — the new wrapWindowsSkillCommandWithNpxPrerequisite and isRemoteRuntimeEnvironmentFocused functions are the core of the change and carry the two noted gaps. All other files are straightforward wiring or delegation to the shared helper.

Important Files Changed

Filename Overview
src/renderer/src/components/settings/CliSkillRuntimeSetup.tsx Core change: adds wrapWindowsSkillCommandWithNpxPrerequisite and isRemoteRuntimeEnvironmentFocused; the function name of the latter slightly overpromises (checks any non-empty activeRuntimeEnvironmentId, not specifically remote). Otherwise well-structured and escape-safe for all known static commands.
src/renderer/src/lib/project-skill-runtime.ts Extracts getProjectAgentSkillTerminalShellOverride into shared library and broadens POSIX-family detection via resolveWindowsShellStartupFamily (now catches Git Bash in addition to wsl.exe). Logic is clean and well-tested.
src/renderer/src/hooks/useActiveProjectSkillRuntime.ts Now returns terminalShellOverride even when no project runtime resolves, fixing the Git Bash shell mismatch for the cmd.exe wrapper. The early-return path correctly delegates to getProjectAgentSkillTerminalShellOverride.
src/renderer/src/components/feature-tips/CliSkillSetupTerminal.tsx Now routes through buildSkillCommandForRuntime and propagates terminalShellOverride; repair-required runtime correctly falls back to host runtime via the installDisabledReason guard.
src/renderer/src/components/settings/LinearAgentSkillPane.tsx Removes useMemo wrappers that could cache a stale command when activeRuntimeEnvironmentId changes. The tradeoff (recompute every render) is acceptable since buildSkillCommandForRuntime is lightweight and the comment explains the reason.
src/renderer/src/components/settings/EphemeralVmsPane.tsx Aligns with sibling panes: absent runtime now falls through to buildSkillCommandForRuntime (host fallback with npx preflight), rather than using the raw constant. Removes useMemo for same reason as LinearAgentSkillPane.
src/renderer/src/components/settings/CliSkillRuntimeSetup.test.tsx Good new test coverage: preflight wrapping, WSL bypass, non-Windows bypass, remote env bypass, metacharacter safety, and POSIX-shell override. The metacharacter test is a valuable guard for cmd.exe safety.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["buildSkillCommandForRuntime(command, runtime)"] --> B{Is runtime WSL?}
    B -->|Yes| C["Build WSL login shell command\n(wsl.exe -d distro -- ...)"]
    B -->|No| D["normalizeWindowsSkillUpdateCommand\n(update → reinstall on Windows)"]
    D --> E["wrapWindowsSkillCommandWithNpxPrerequisite(command, platform)"]
    E --> F{platform === 'win32'?}
    F -->|No| G["Return command unchanged"]
    F -->|Yes| H{isRemoteRuntimeEnvironmentFocused?}
    H -->|Yes| G
    H -->|No| I{"matches /^npx\\s+skills\\s+(?:add|update)/i?"}
    I -->|No| G
    I -->|Yes| J["cmd.exe /d /s /c\nwhere.exe npx check +\nif errorlevel 1 → print guidance\nelse → run command"]
    J --> K{Shell override needed?}
    K -->|Git Bash or wsl.exe| L["terminalShellOverride = powershell.exe"]
    K -->|cmd.exe or powershell.exe| M["No override"]
    L --> N["Open terminal in PowerShell with cmd.exe wrapper"]
    M --> O["Open terminal in configured shell"]
Loading

Reviews (1): Last reviewed commit: "test(settings): pin the ephemeral VMs pa..." | Re-trigger Greptile

@brennanb2025
brennanb2025 merged commit 0d4baf2 into stablyai:main Jul 29, 2026
25 checks passed
brennanb2025 added a commit that referenced this pull request Jul 31, 2026
…ws shells

The cmd.exe npx preflight added in #10453 silently no-ops when pasted
into Git Bash: MSYS rewrites the leading /d /s /c switches into drive
paths, so cmd.exe starts an interactive session and never runs the
payload. Skip the wrapper when the configured Windows shell resolves to
the posix family, matching the shell the copied command actually lands
in.
brennanb2025 added a commit that referenced this pull request Jul 31, 2026
…ws shells (#11599)

The cmd.exe npx preflight added in #10453 silently no-ops when pasted
into Git Bash: MSYS rewrites the leading /d /s /c switches into drive
paths, so cmd.exe starts an interactive session and never runs the
payload. Skip the wrapper when the configured Windows shell resolves to
the posix family, matching the shell the copied command actually lands
in.
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…i#10453)

* fix(settings): guide Windows skill setup when npx is missing

* fix(settings): resolve npx by PATHEXT and keep the preflight off POSIX shells

Review fixes on the Windows npx preflight:

- Probe and run bare `npx` instead of pinning `npx.cmd`. cmd.exe resolves both
  through PATHEXT, so shims that ship `npx.exe` (Volta) no longer get told
  "npx was not found" on a machine where npx works.
- Force the skill terminal to PowerShell when the configured Windows shell is
  POSIX-family. Git Bash rewrites the leading `/d /s /c` arguments as MSYS
  paths, which would break a command that runs fine there today.
- Drop the "restart Orca" advice. Every new PTY merges the persisted Windows
  PATH, so a new setup terminal already picks up a fresh Node install.
- Fall back to the plain command on the two newly routed call sites when the
  project runtime is repair-required, matching the eight existing callers.
  Those sites otherwise emitted a wsl.exe command for a missing distro.

Adds coverage for the Git Bash override and for cmd.exe block safety.

* fix(settings): apply the skill-terminal shell override on every wrapped path

The Windows npx wrapper is emitted whenever buildSkillCommandForRuntime falls
back to the local host, but three paths never consulted the shell override, so
a Git Bash user still got the cmd.exe string pasted into MSYS:

- useActiveProjectSkillRuntime returned an empty result whenever no local
  project runtime resolved (no repo yet, or an SSH/remote repo) while the
  command builder kept wrapping. It now resolves the override for that same
  host fallback, so the wrap gate and the shell gate agree.
- The Linear setup prompt carried a third copy of the override that was still
  on the old wsl.exe-only check. It now delegates, as does the settings copy,
  leaving one implementation.
- MobileEmulatorAgentControlRow built wrapped commands but passed no override.

Also drops the unreachable WSL guard inside the wrapper; the only caller is
already on the non-WSL branch.

* fix(settings): keep the npx preflight off remote runtimes and finish the emulator row

- Skill setup terminals spawn on the focused runtime environment, so a Windows
  client was handing a cmd.exe command to a remote Linux host where the plain
  npx command used to run. Skip the wrapper whenever a runtime environment is
  focused.
- MobileEmulatorAgentControlRow was left half routed: it took the project
  runtime's shell override while still building a Windows host command, so a
  WSL project got the cmd.exe wrapper inside a WSL shell. Build its commands
  from the same runtime, matching MobileEmulatorAgentSetupGuideSteps.

* fix(settings): match the terminal router when skipping the npx preflight

- The remote check used settings.activeRuntimeEnvironmentId, but the setup
  terminal routes through getSingleFocusedRuntimeEnvironmentId, which keeps the
  terminal local unless exactly one saved environment is focused. Users with
  two or more environments lost the preflight while still running locally.
- LinearAgentSkillPane memoized its commands on the project runtime alone. The
  built command now also depends on the focused runtime environment, and
  Settings panes stay mounted, so the memo could serve a stale Windows command
  after a runtime switch. Compute it inline like every sibling pane.

* fix(settings): keep emulator skill setup installing where detection looks

The mobile emulator surfaces detect the Orca CLI skill with a local-host scan
that takes no discovery target, so building their commands from the project
runtime made a WSL project install into the distro while detection kept
scanning Windows: the panel stayed "Not installed" with no way out. Build host
commands there again, as the surrounding comment already documented, and keep
only the terminal shell override those surfaces actually needed.

Also narrow the remote check back to the focused environment id. Matching the
terminal router exactly meant reading runtimeEnvironments, which nothing on
these surfaces subscribes to, so adding or removing an environment mid-session
could leave a stale decision. The focused id alone over-skips instead, which
degrades to the previous behavior rather than sending cmd.exe to a remote host.

* fix(feature-tips): keep the npx preflight on the repair-required fallback

installDisabledReason is only ever set on Windows, so dropping the whole
command builder on that branch stripped the npx preflight exactly where it is
needed. This terminal auto-pastes with no install gate, so that fallback put
the bare npx command straight back in front of the user stablyai#10438 describes. Drop
to the host runtime instead, which still avoids the missing WSL distro.

Pins the two call-site invariants that were unguarded: the emulator surfaces
must build host commands because their detection scans the host only, and the
Linear prompt's shell override must cover POSIX-family Windows shells.

* fix(settings): reach the npx preflight from the ephemeral VMs pane too

This pane was the only one of eight requiring a resolved project runtime
before building its command, so a Windows user with no repo added yet — the
state issue stablyai#10438 was reported from — got the bare npx command and the same
dead end. An absent runtime already resolves to the local host, which is what
the sibling panes rely on.

Also pins the repair-required host fallback added in the previous commit; the
existing assertions all passed against the old form.

* test(settings): pin the ephemeral VMs pane to the host-resolving command

Reverting the previous commit left the whole suite green, and this is a PR
where several regressions came from an earlier fix, so guard it the same way
the emulator call sites are guarded.

---------

Co-authored-by: Brennan Benson <[email protected]>
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…ws shells (stablyai#11599)

The cmd.exe npx preflight added in stablyai#10453 silently no-ops when pasted
into Git Bash: MSYS rewrites the leading /d /s /c switches into drive
paths, so cmd.exe starts an interactive session and never runs the
payload. Skip the wrapper when the configured Windows shell resolves to
the posix family, matching the shell the copied command actually lands
in.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] npx errors on Windows when installing orca skills

3 participants