Repository navigation
fix(settings): guide Windows skill setup when npx is missing - #10453
brennanb2025 merged 9 commits into
Conversation
📝 WalkthroughWalkthroughSkill 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 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/renderer/src/components/settings/agent-skill-installed-command-callers.test.ts (1)
71-75: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCover 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
📒 Files selected for processing (6)
src/renderer/src/components/emulator-pane/MobileEmulatorAgentSetupGuideSteps.tsxsrc/renderer/src/components/feature-tips/CliSkillSetupTerminal.tsxsrc/renderer/src/components/settings/CliSkillRuntimeSetup.test.tsxsrc/renderer/src/components/settings/CliSkillRuntimeSetup.tsxsrc/renderer/src/components/settings/OrchestrationPane.test.tsxsrc/renderer/src/components/settings/agent-skill-installed-command-callers.test.ts
…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.
|
Thanks for this — the diagnosis is right and the approach holds up. Checking and then running the same I reviewed it against current
On testing: CI had no evidence beyond Two things I did not change, worth calling out:
The |
There was a problem hiding this comment.
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
📒 Files selected for processing (15)
src/renderer/src/components/emulator-pane/MobileEmulatorAgentSetupGuideSteps.tsxsrc/renderer/src/components/feature-tips/CliSkillSetupTerminal.tsxsrc/renderer/src/components/settings/CliSkillRuntimeSetup.test.tsxsrc/renderer/src/components/settings/CliSkillRuntimeSetup.tsxsrc/renderer/src/components/settings/EphemeralVmsPane.tsxsrc/renderer/src/components/settings/LinearAgentSkillPane.tsxsrc/renderer/src/components/settings/MobileEmulatorAgentControlRow.tsxsrc/renderer/src/components/settings/OrchestrationPane.test.tsxsrc/renderer/src/components/settings/agent-skill-installed-command-callers.test.tssrc/renderer/src/components/sidebar/linear-agent-skill-runtime.shell-override.test.tssrc/renderer/src/components/sidebar/linear-agent-skill-runtime.tssrc/renderer/src/hooks/useActiveProjectSkillRuntime.test.tsxsrc/renderer/src/hooks/useActiveProjectSkillRuntime.tssrc/renderer/src/lib/project-skill-runtime.test.tssrc/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
| 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' |
There was a problem hiding this comment.
📐 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
| 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()) | ||
| } |
There was a problem hiding this comment.
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!
| 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})"` |
There was a problem hiding this comment.
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 SummaryThis PR fixes a poor Windows UX where the skill setup terminal would run
Confidence Score: 4/5The 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.
|
| 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"]
Reviews (1): Last reviewed commit: "test(settings): pin the ephemeral VMs pa..." | Re-trigger Greptile
…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.
…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.
…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]>
…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.
Summary
Fixes #10438.
Windows skill setup currently opens a terminal with an
npx skillscommand even whennpxis unavailable. PowerShell then reports a genericCommandNotFoundException, leaving users without a recovery path.This change:
npx.cmdbefore native Windows skill install and update commandsPATH, and restart guidance when it is missingnpx.cmdshim found by the prerequisite checkScreenshots
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 lintpnpm typecheckpnpm 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 buildAdditional validation:
git diff --checkpassed.assembleReleasepassed: 987 tasks completed.npx.cmdwas absent.C:\Program Files\nodejs\npx.cmdshim.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
npxcould resolve a different PowerShell shim than the command eventually executed. The implementation now checks and runsnpx.cmdconsistently behind acmd.exeboundary 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 addandnpx skills updatecommands 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
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.