Skip to content

fix(wsl): Share only starts the stopped distros that hold the chosen skills - #35659

Merged
nwparker merged 1 commit into
mainfrom
nwparker/wsl-share-scope-stopped-roots
Oct 29, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/wsl-share-scope-stopped-roots

Conversation

@nwparker

@nwparker nwparker commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​82 $\color{#cf222e}{\Huge{\mathbf{−}}}$​7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​75
Prod 10 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​86 $\color{#cf222e}{\Huge{\mathbf{−}}}$​29 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​57

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

  • Desktop Share dialog. It now sends the chosen skills' folders (skillDirectories) with skills:prepareShare. Discovery takes readStoppedWslRootsFor, 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 reported unavailable. 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.share RPC. 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.
  • Gated scans and user-act scans of the same target, with different folder sets, get distinct coalescer keys, so one can never answer another.

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 back unavailable. '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: prepareShare carries skillDirectories.

  • Checks run locally:

    • typecheck: pnpm tc, typecheck:ci
    • lint and quality gates: check:code-quality:changed, the anti-slop oxlint (after the plugin sync), oxlint, the js-plugins and code-quality native-plugins oxlint, oxfmt
    • ast-grep: ast-grep test and ast-grep-gates.mjs
    • repository checks: import boundaries, the sync-spawn ratchet, React Doctor, test-file runners, the localization catalogs
    • the touched suites
  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • SSH: unaffected. The stopped-distro logic only applies to \\wsl.localhost paths.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

…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.
@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[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

  1. P2 Folder scan separation lacks tests ▶

Summary

Share now sends the chosen skills’ folders and allows stopped WSL roots only when they contain a chosen folder.

  • Share reads only stopped WSL roots that can hold selected skills.
  • The skill-sharing CLI searches stopped distros only when a name is missing.

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.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  Desktop[Desktop Share] --> Folders[Send chosen skill folders]
  Folders --> Limited[Allow only matching stopped roots]
  CLI[CLI Share] --> Gated[Scan with stopped roots blocked]
  Gated --> Missing{Selector missing and source unavailable?}
  Missing -->|Yes| All[Retry allowing all stopped roots]
  Missing -->|No| Publish[Prepare and publish selected skills]
  Limited --> Publish
  All --> Publish
Loading

Reviews (1) · Last reviewed commit: "fix(wsl): Share only starts the stopped ..." · Reviewed by Greptile

Comment on lines +166 to +173
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}`,

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 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!

@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Walkthrough

Share preparation now passes selected skill directories to discovery. Discovery can read selected stopped WSL roots, or all stopped roots when requested. The skills.share flow retries with all stopped roots when a selector is unmatched and a source is unavailable.

Priority: Normal

Merge Risk: Moderate · up to 18693

The change is meant to stop Share from reading WSL roots that hold none of the selected skills. For the distro the Share dialog runs against, it still reads all roots on that distro, so the intended narrowing does not take effect there. A small case-folding over-match also remains. Neither is worse than the previous behavior, but both should be fixed before merge for the feature to work as described.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title "fix(wsl): Share only starts the stopped distros that hold the chosen skills" names the main change: Share now starts only the stopped WSL distros that hold the selected skills. It follows t…
Description check Passed The description follows the template closely. It has an ELI5 section, a What Changed section with the mechanism, a Why section that covers the alternative (the two-pass CLI scan), Testing notes, an Ag…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "fix(wsl): Share only starts the stopped distros that hold the chosen skills" names the main change: Share now starts only the stopped WSL distros that hold the selected skills. It follows the conventional-commit style and is specific. It is a single sentence of 12 words, which is slightly long but readable.

Full details: Description check

Explanation

The description follows the template closely. It has an ELI5 section, a What Changed section with the mechanism, a Why section that covers the alternative (the two-pass CLI scan), Testing notes, an Agent skill upstream boundary checkbox, Notes on SSH, and a checklist. The Linked Issue section is incomplete: it reads 'Follow-up to #34632 (E9, no background boots); no issue' and does not use the required 'Fixes #' link. The template says outside contributors must link an actual issue, but the author may be a maintainer, and the template allows that exception. The AI Disclosure section is missing. The Visual Proof section says N/A with a reason, which is allowed. The unchecked 'manually tested' box and the unconfirmed pnpm lint/typecheck/test/build checklist item are open items the author should resolve or explain.

Resolution

Consider these items before merge: (1) Replace the Linked Issue text with a 'Fixes #' reference to an existing issue, or confirm that the maintainer exception applies. (2) Add or fill in the AI Disclosure section, or leave it blank only if the author is a StablyAI team member. (3) Mark the manual testing checkbox or state that manual testing was not done. (4) Confirm that pnpm lint, typecheck, test, and build pass, or note that CI covers them.

Full details: Docstring Coverage

Explanation

Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 6 functions across 14 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

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
Commits

Reviewing files that changed from the base of the PR and between 4a24d5a and 1869379.

Files selected for processing: 14
  • src/main/ipc/skill-cloud-ipc-handlers.ts
  • src/main/ipc/skill-share-publishing-ipc-schemas.ts
  • src/main/ipc/skills.test.ts
  • src/main/ipc/skills.ts
  • src/main/runtime/rpc/methods/skills.test.ts
  • src/main/runtime/rpc/methods/skills.ts
  • src/main/skills/discovery-wsl-stopped-distro.test.ts
  • src/main/skills/discovery.ts
  • src/main/skills/skill-discovery-stopped-wsl-roots.ts
  • src/main/skills/skill-discovery-target.ts
  • src/preload/api/agent-skill-api.ts
  • src/preload/api/skills-bridge.ts
  • src/renderer/src/components/skills/SkillShareDialog.test.tsx
  • src/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)) {

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.

Major · Functional Correctness · Heavy lift

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()

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.

Minor · Functional Correctness · Quick win

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)

@nwparker
nwparker merged commit cf15284 into main Oct 29, 2026
50 checks passed
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.

1 participant