Skip to content

fix(skills): preserve WSL discovery command as one bash argument - #12978

Closed
innocarpe wants to merge 1 commit into
stablyai:mainfrom
innocarpe:fix/wsl-skills-discover-command
Closed

innocarpe wants to merge 1 commit into
stablyai:mainfrom
innocarpe:fix/wsl-skills-discover-command

Conversation

@innocarpe

Copy link
Copy Markdown
Contributor

Description

On Windows, WSL skill discovery passed a multi-command scan payload directly as bash's -c argument. Windows argument handling could split the payload before bash received it, leaving the Settings skill check stuck on Not installed.

Focused fix

  • In scope: invoke bash with a fixed eval "$1" script and pass the discovery payload as a positional argument.
  • In scope: preserve the existing WSL distro selection and discovery payload.
  • Out of scope: skill scan content, skill installation, shell preference, and non-WSL discovery.

Preserves

  • Metadata discovery and scan output parsing are unchanged.
  • The existing command payload remains the only script evaluated inside WSL.

Evidence

  • Targeted Vitest: 2 files, 5 tests passed.
  • Regression coverage verifies that the semicolon-delimited scan script is outside bash's -c argument and is passed unchanged as $1.
  • oxfmt, oxlint, and git diff checks passed after rebasing onto current upstream/main.

User-regression-tradeoffs

  • The command adds one fixed bash evaluation layer so Windows/WSL argument boundaries remain stable.
  • Linux and macOS discovery paths are unchanged.

Fixes #12964

@coderabbitai

coderabbitai Bot commented Aug 7, 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: Pro Plus

Run ID: 0be81476-3422-4d72-bbc7-e8f1e97940a1

📥 Commits

Reviewing files that changed from the base of the PR and between 7e60b33 and 7c40b0e.

📒 Files selected for processing (3)
  • src/main/skills/skill-discovery-wsl-plugins.test.ts
  • src/main/skills/skill-discovery-wsl.test.ts
  • src/main/skills/skill-discovery-wsl.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/skills/skill-discovery-wsl.test.ts

📝 Walkthrough

Walkthrough

WSL skill discovery now builds a separated wsl.exe argument list with distro selection, bash -c, escaped eval "$1", and the discovery payload. Execution passes these arguments to execFile. Tests verify payload placement, the pipefail and base64 pipeline, metadata arguments, and the updated encoded scan-script position.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the fix and evidence, but it omits the required AI Review Report, Security Audit, and template sections. Add the required Summary, Screenshots, Testing, AI Review Report, Security Audit, and Notes sections, including cross-platform and security review details.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the WSL discovery argument-handling fix, which is the main change.
Linked Issues check ✅ Passed The implementation preserves the WSL payload and distro selection while passing the payload as $1, directly addressing issue #12964.
Out of Scope Changes check ✅ Passed The code and tests remain limited to WSL skill discovery argument handling and related regression coverage.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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.

@innocarpe
innocarpe force-pushed the fix/wsl-skills-discover-command branch from 8be797f to 7c40b0e Compare August 7, 2026 05:07
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@OrcaWin

OrcaWin commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

Closing as superseded — the splitting hazard you identified is real, but it no longer exists on main.

#15039 ("fix(wsl): pass guest argv verbatim through --exec") changed every wsl.exe invocation from the -- mode separator to --exec. That matters here because wsl.exe … -- <argv> preprocesses each argument before the guest sees it, which is what could mangle the discovery payload; --exec passes argv through untouched. executeWslSkillDiscovery is on that path now:

['-d', distro, '--exec', 'bash', '-c', command]

I verified the current shape against a real Ubuntu-24.04 with a payload containing spaces, embedded quotes, &, and $HOME:

node -> execFileSync('wsl.exe', ['-d', D, '--exec', 'bash', '-c', <base64 wrapper>])
payload survived intact -> "A B | quoted \"x\" & /home/neil | done\n"

So the eval "$1" positional-argument wrapper is no longer needed to keep the payload in one piece.

One practical note if you'd rather rebase than close: this PR asserts the ['-d', 'Ubuntu', '--', 'bash', '-c'] argv shape, and main now has a guard test (src/shared/wsl-exec-mode-separator.test.ts) that fails on any wsl.exe … -- + shell form, so those assertions would need to move to --exec regardless.

Happy to reopen if skill discovery still gets stuck on "Not installed" for you on current main — that would point at a different cause worth chasing.

@OrcaWin OrcaWin closed this Aug 18, 2026
@innocarpe

Copy link
Copy Markdown
Contributor Author

Thanks @OrcaWin — agreed. #15039's --exec path removes the splitting hazard this PR was wrapping around, and the old wsl.exe … -- bash -c assertions would now fail the --exec guard on main.

Closing the fork portfolio mirror as well. Happy to reopen only if skill discovery still reports "Not installed" on current main.

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.

skills:discover fails via wsl.exe -d Ubuntu -- bash -c on Windows (v1.4.175) — unaffected by Default Shell setting, separate from #8806 fix

3 participants