Repository navigation
fix(settings): make WSL skill commands pasteable (#7795) - #7881
Conversation
📝 WalkthroughWalkthroughThis change updates the WSL command execution path in 🚥 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/CliSkillRuntimeSetup.tsx (1)
82-85: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueAdd a brief comment explaining the
bash -ilcchoice.The switch from the removed shell-detection helpers to a hardcoded
bash -ilcwrapper is a non-obvious constraint (interactive login shell to pick up the user's PATH, and a directly pasteable form for the selected distro). A short "why" comment here would preserve that intent, mirroring the existing rationale comment innormalizeWindowsSkillUpdateCommand.📝 Suggested comment
const distroArg = resolvedRuntime.wslDistro?.trim() ? ` -d ${quotePowerShellSingle(resolvedRuntime.wslDistro.trim())}` : '' + // Why: run through an interactive login bash so the user's PATH (nvm, etc.) + // is available, and emit a directly pasteable command instead of the prior + // sh -c login-shell-detection wrapper that broke argv quoting on Windows→WSL. return `wsl.exe${distroArg} -- bash -ilc ${quotePowerShellSingle(normalizedCommand)}`As per coding guidelines: "When writing or modifying code driven by a design doc or another non-obvious constraint, add a brief comment explaining why the code behaves that way."
Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 7bf302d8-fbe2-4195-ac14-2aec4c6e5adc
📥 Commits
Reviewing files that changed from the base of the PR and between 7e1a777 and d4a41de15bf48e89774fa4e7d12a43061834907b.
📒 Files selected for processing (2)
src/renderer/src/components/settings/CliSkillRuntimeSetup.test.tsxsrc/renderer/src/components/settings/CliSkillRuntimeSetup.tsx
d4a41de to
e485c50
Compare
- Encode the WSL login-shell script as base64 and decode/eval it inside the sh -c invocation, avoiding raw nested quotes at the paste boundary - Scope $PSNativeCommandArgumentPassing = 'Legacy' to the invocation so PS 5.1 and PS 7 both hand wsl.exe the same escaped argv - Extract powershell-native-argument.ts as the shared quoting module and reuse it from ssh-remote-powershell.ts
e485c50 to
cb77169
Compare
Review: WSL skill command escaping ✅Traced the generated command through every layer and it holds up. For the WSL paste path it now emits: & { $PSNativeCommandArgumentPassing = 'Legacy'; wsl.exe -d 'Ubuntu' -- sh -c 'eval \"`printf %s <BASE64> | base64 -d`\"' } # Runs: npx skills add orchestration --globalWhy it's correct:
Gates run locally: affected unit tests + full settings suite (570) + shell/ssh suites (652) pass; web+node typecheck clean; oxlint clean; max-lines ratchet OK. The Optional nit (non-blocking): the No defects found. LGTM. |
Main's stablyai#7892 made listMobileSessionTabs validate selectors via this.store?.getRepo; the mock store here only defined getWorkspaceSession, so the merged CI build threw 'getRepo is not a function'. Return null (wt-1 is a worktree id, not a repo). Co-authored-by: Orca <help@stably.ai>
…kill-update-command-escaping
|
thanks for reporting. looking into it |
1 similar comment
|
thanks for reporting. looking into it |
…blyai#7881) * fix(settings): make WSL skill commands pasteable (stablyai#7795) * Fix WSL skill commands so PowerShell 7 pastes match PowerShell 5.1 argv - Encode the WSL login-shell script as base64 and decode/eval it inside the sh -c invocation, avoiding raw nested quotes at the paste boundary - Scope $PSNativeCommandArgumentPassing = 'Legacy' to the invocation so PS 5.1 and PS 7 both hand wsl.exe the same escaped argv - Extract powershell-native-argument.ts as the shared quoting module and reuse it from ssh-remote-powershell.ts * test(runtime): stub getRepo in mobile-tab startup cwd test Main's stablyai#7892 made listMobileSessionTabs validate selectors via this.store?.getRepo; the mock store here only defined getWorkspaceSession, so the merged CI build threw 'getRepo is not a function'. Return null (wt-1 is a worktree id, not a repo). Co-authored-by: Orca <help@stably.ai> --------- Co-authored-by: Jinjing <6427696+AmethystLiang@users.noreply.github.com> Co-authored-by: Orca <help@stably.ai>
Summary
sh -cstring.Closes #7795.
Screenshots
No visual change.
Testing
pnpm lintpnpm typecheckpnpm testpnpm buildFocused validation:
pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/settings/CliSkillRuntimeSetup.test.tsx- passed,Test Files 1 passed (1),Tests 8 passed (8).pnpm run typecheck:web- passed.pnpm exec oxlint src/renderer/src/components/settings/CliSkillRuntimeSetup.tsx src/renderer/src/components/settings/CliSkillRuntimeSetup.test.tsx- passed.pnpm exec oxfmt --check src/renderer/src/components/settings/CliSkillRuntimeSetup.tsx src/renderer/src/components/settings/CliSkillRuntimeSetup.test.tsx- passed,All matched files use the correct format.AI Review Report
-ilcpayload, avoiding escaped shell substitutions and nested doubled quotes in copied command text.Security Audit
Notes
No visual change. The command now assumes Bash inside WSL for this settings setup path, matching the direct runnable form users can paste into the selected distro.