Repository navigation
fix(wsl): Share only starts the stopped distros that hold the chosen skills - #35659
Conversation
…skills #34632 let Share read every stopped WSL distro's skill folders. The Share dialog now sends the chosen skills' folders, and discovery reads only the stopped roots (and workspace plugin folder) that hold them; every other stopped root stays unread and unavailable. The skills.share RPC names skills, not folders, so it scans gated first and reads stopped roots only when a selector is missing and a folder went unread.
[Medium impact] The PR changes stopped-WSL reads in the desktop and CLI skill-sharing workflows. The PR appears safe to merge, with a non-blocking request to test concurrent scans with different folder permissions. Findings
SummaryShare now sends the chosen skills’ folders and allows stopped WSL roots only when they contain a chosen folder.
Intent recorded: nwparker explicitly states that finding every CLI selector on the first pass should leave other stopped distros unread. The possible hidden-name ambiguity was set aside for that reason.
|
| const userActKey = | ||
| readFor === undefined | ||
| ? '' | ||
| : `:user-act:${readFor === 'all' ? 'all' : stablePathId([...readFor].sort().join('\0'))}` | ||
| try { | ||
| const outcome = await targetScans.run( | ||
| // A gated and an ungated scan of one target must not answer for each other. | ||
| `${scanKey(target, repos, options.providerRootOverrides)}${options.gateStoppedWslDistros === false ? ':user-act' : ''}`, | ||
| `${scanKey(target, repos, options.providerRootOverrides)}${userActKey}`, |
There was a problem hiding this comment.
Folder scan separation lacks tests
The new userActKey controls whether requests with different folder permissions share a result, but no test checks simultaneous requests with different folder lists. A regression could make Share receive another request’s incomplete result without failing the current tests.
Add concurrent tests for different lists, the same list in a different order, and passive discovery versus 'all'.
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!
Walkthrough
Priority: Merge Risk:
|
There was a problem hiding this comment.
Actionable comments posted: 2

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
5b788002-a0f6-45b8-8005-e290b12f658a
Files selected for processing: 14-
src/main/ipc/skill-cloud-ipc-handlers.tssrc/main/ipc/skill-share-publishing-ipc-schemas.tssrc/main/ipc/skills.test.tssrc/main/ipc/skills.tssrc/main/runtime/rpc/methods/skills.test.tssrc/main/runtime/rpc/methods/skills.tssrc/main/skills/discovery-wsl-stopped-distro.test.tssrc/main/skills/discovery.tssrc/main/skills/skill-discovery-stopped-wsl-roots.tssrc/main/skills/skill-discovery-target.tssrc/preload/api/agent-skill-api.tssrc/preload/api/skills-bridge.tssrc/renderer/src/components/skills/SkillShareDialog.test.tsxsrc/renderer/src/components/skills/SkillShareDialog.tsx
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
-
| roots.map(async (root) => { | ||
| const distro = wslDistroForPath(root.path) | ||
| if (!distro) { | ||
| if (!distro || mayReadStopped(root.path)) { |
There was a problem hiding this comment.
Check unselected roots outside the WSL user-act allowance.
When Share supplies a WSL cwd, both the IPC and RPC paths run discovery inside runAsWslUserAct for that distro. For an unselected root on the same distro, blockedWslDistroForPath returns null because the scope authorizes the distro. The first Share scan can therefore read every root on that distro, despite mayReadStopped rejecting those roots. The plugin-cwd check has the same bypass. Check whether unselected roots and plugin metadata are stopped without applying the user-act allowance; retain the allowance for selected roots. (raw.githubusercontent.com)
| return path | ||
| .replace(/[\\/]+/g, '/') | ||
| .replace(/\/$/, '') | ||
| .toLowerCase() |
There was a problem hiding this comment.
Preserve the case of Linux path components.
If a WSL distro contains both /repo and /Repo, lowercasing makes a selected skill under one repo match the other repo’s skill root. Share then reads a root that the user did not select. Normalize the UNC host and distro names separately, but compare the Linux path components with their original case. (raw.githubusercontent.com)
ELI5
Sharing a skill should only start the WSL distro that actually holds that skill. After #34632, Share could start every stopped distro that has a WSL project, just to look for the one you picked. Now Share reads only the folders that hold the skills you chose. Every other stopped distro stays stopped.
User risk: none outside Share. Ordinary skill views and background discovery are unchanged. Sharing a skill that lives on a host folder or a running distro behaves exactly as before.
What Changed
skillDirectories) withskills:prepareShare. Discovery takesreadStoppedWslRootsFor, which accepts either'all'or a list of skill folders. Given a list, it reads a stopped distro's root, or its workspace plugin folder, only when that root holds one of the chosen folders. Every other stopped root stays unread and is reportedunavailable. A caller that sends no folders falls back to'all', which is fix(wsl): background repo probes, PR refresh and worktree scans never start a stopped distro (E9) #34632's behaviour.skills.shareRPC. The agent CLI names skills by id or name, not by folder, so this path scans with the gate first. It reads stopped roots only if a selector is missing and some folder went unread.Why
Limiting the scan to the chosen folders is the narrowest rule that still lets Share find its skills. For the CLI, which has no folders, the two-pass scan only starts other distros when the first pass couldn't find a named skill. That's the only case where doing so can help.
This is internal desktop IPC, so the main process and the renderer always ship at the same version, and the new field is optional anyway.
Linked Issue
Follow-up to #34632 (E9, no background boots); no issue.
Visual Proof
N/A. No UI change: Share looks the same and only reads less.
Testing
skills/discovery-wsl-stopped-distro.test.ts: with a stopped distro, Share given the chosen folder finds the WSL repo's skill. The distro's other roots are never read (every fs call is recorded) and come backunavailable.'all'still reads everything.ipc/skills.test.ts: the Share dialog with no target passes its folders through, falls back to'all'without them, and passive discovery passes neither.rpc skills.test.ts: when every selector is found, there's one gated scan. When a selector is missing and a folder went unread, a second scan runs with'all'.SkillShareDialog.test.tsx:prepareSharecarriesskillDirectories.Checks run locally:
pnpm tc,typecheck:cicheck:code-quality:changed, the anti-slop oxlint (after the plugin sync), oxlint, the js-plugins and code-quality native-plugins oxlint, oxfmtast-grep testandast-grep-gates.mjsI manually tested these changes locally
Automated tests added/updated, or explained why not below
Review
Agent skill upstream boundary
Notes
\\wsl.localhostpaths.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)