Skip to content

fix(wsl): detect agents in multi-repository folder workspaces - #28697

Closed
abruption wants to merge 1 commit into
stablyai:mainfrom
abruption:fix/wsl-folder-agent-detection
Closed

abruption wants to merge 1 commit into
stablyai:mainfrom
abruption:fix/wsl-folder-agent-detection

Conversation

@abruption

Copy link
Copy Markdown
Contributor

ELI5

A folder containing several WSL repositories should offer agents installed in that WSL distribution. Today it can instead show Windows agents. This makes the picker follow the folder's own WSL path and keeps its list separate from Windows folders.

What Changed

  • Resolve a proven local WSL folder from its own UNC path when there is no unique owning repository, using the existing runtime resolver and detection cache.
  • Carry the requested folder through the picker target and subscribe to that folder's inventory. A warmed Windows list or a late result from another folder no longer supplies its rows.
  • Preserve existing explicit runtime preferences, Floating terminals, native Windows/non-Windows paths, SSH and paired-host ownership checks. An unavailable distribution keeps the existing repair-required behavior.

Why

Picking an arbitrary repository would give ambiguous multi-repository folders the wrong runtime. Reusing the existing path parser, ownership checks, runtime resolution and probe fixes the missing context without adding another discovery or execution mechanism.

Linked Issue

Fixes #28382

Visual Proof

Captured from a hidden Windows 10 / Ubuntu-24.04 Session 2 Electron window through CDP, using four real WSL Git repositories and a real Linux-only OpenCode 1.19.0 executable. The original installed app was 1.4.206; the To-be app was a separate copy using the unchanged candidate source functions/hooks, original UI/store/main IPC and PTY backend. This is an installed-runtime integration check, not a packaged latest-main release. The source is rebased onto main 9c0420fa9a and checked again below.

Before: Windows agents in the WSL folder; OpenCode missing After: the WSL-only OpenCode is offered
Before: incorrect Windows agent menu in a four-repository WSL folder After: OpenCode from the folder's WSL distribution

Selecting OpenCode executes the real Linux CLI from the exact WSL folder; the terminal records exit 0, Linux, the expected cwd and version 1.19.0:

Actual WSL PTY execution proof

Testing

  • I manually tested these changes locally

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

  • After rebasing onto main 9c0420fa9a: 15 focused test files / 194 tests passed; renderer typecheck, changed-code quality, formatting and diff checks passed.

  • Regression coverage includes a warm Windows inventory, a retained picker switching distributions, a requested nonactive folder, a late result after switching folders, same-ID local/remote folders, missing distributions and non-Windows/native/Floating paths.

  • Real Windows Session 2 UI: register four WSL repositories, open their folder, compare the New tab menu, select OpenCode and confirm Linux/version/exit/cwd through the actual PTY. Windows → WSL → Windows → WSL sidebar navigation kept the two inventories separate.

  • Separate native Windows → WSL function smoke executed the real Linux Claude 2.1.296 version command. A delegated Claude baseline run also reported the wrong menu and a Windows-only Claude selection failing in WSL; its Windows-only attachments were not independently inspected.

  • Reproduce the UI check with a WSL-only agent, a Windows-only agent and a folder whose group has at least two WSL repositories. Warm the Windows picker, select the WSL folder, and verify that the menu and execution follow that distribution; switch back to a native folder and repeat.

  • Production Electron renderer build and boot-graph verification passed on the rebased source.

  • Full repository lint/test/typecheck and multi-platform packaging are left to CI. No vendor authentication or model turn was tested; the live launch used --version deliberately.

AI Disclosure

Codex implemented the code and tests, performed the review, drove the CDP validation and wrote this PR. A separate Claude Code session performed a baseline desktop test, relayed through a Codex session. This is not a claim of independent candidate review by Claude.

Review

Reviewed cross-platform behavior, local/SSH/paired-host ownership, provider-neutral agent selection, performance and basic security. The new path fallback is Windows-only and requires a proven local folder; other hosts keep their existing routes. It reuses cached snapshots and scoped inventories, sends no new remote fields and introduces no shell command, credential handling or provider-specific execution logic. No layout or style changes.

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

During setup, OpenSSH Session 0 could not access either WSL UNC spelling, while the logged-on Session 2 could. The same failure occurred in standalone Node before Orca launched, so it is recorded as a test-environment limitation with an undetermined cause, not a new Orca defect or a problem this PR fixes. The desktop test proceeded successfully in Session 2. Original installation and user profiles were preserved, and task-owned processes, fixtures and temporary resources were cleaned up.

Author

X: @abruptWave

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)

@coderabbitai

coderabbitai Bot commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1bf917d4-a646-4949-9e08-2dfd6c409097
📥 Commits

Reviewing files that changed from the base of the PR and between 9c0420f and af68247.

📒 Files selected for processing: 6
  • src/renderer/src/hooks/useAgentDetectionTarget.ts
  • src/renderer/src/hooks/useDetectedAgents.local-folder.test.tsx
  • src/renderer/src/hooks/useDetectedAgents.ts
  • src/renderer/src/lib/local-folder-agent-preflight-context.test.ts
  • src/renderer/src/lib/local-folder-agent-preflight-context.ts
  • src/renderer/src/lib/local-preflight-context.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

📝 Walkthrough

Windows folder worktrees with qualifying WSL paths now resolve folder-specific preflight context. Local agent detection keys distinguish folder worktrees, and useDetectedAgents derives a context key from local preflight context when no explicit key is set. Added tests cover WSL distro selection, folder switching, cache behavior, and delayed detection results.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to af682

No actionable merge-blocking issue remains; the folder view and detection request use the same context key.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 23.08% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 6 files. 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 clearly and concisely describes the main change: fixing agent detection for WSL in multi-repository folder workspaces.
Description check Passed The description is complete and aligned with the template. It explains the user impact, implementation, rationale, linked issue, visual proof, testing, AI disclosure, compatibility review, limitations…
Linked Issues check Passed The PR satisfies the coding requirements in [#28382]. On Windows, the new folder preflight path accepts a local folder target, validates its local ownership and WSL UNC path, and resolves the distro f…
Out of Scope Changes check Passed The changes stay within [#28382]. The modified preflight, picker-target, inventory-subscription, and cache logic directly supports folder-specific WSL agent detection. The added tests verify the reque…
  • Fix all pre-merge checks with AI
  • 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.

@nwparker

Copy link
Copy Markdown
Contributor

Thanks for working on this fix! This works out the WSL runtime for multi-repo folder workspaces from their \\wsl.localhost path so Windows-side agent detection probes the right distro. The new WSL hosts bridge runs Orca's server inside the distro, so the folder belongs to that host and agents are detected from inside the distro.

To switch: Settings → Experimental → WSL hosts, then Add a project → Add remote host → Add WSL distro. Existing \\wsl.localhost or W:\ projects can be moved over from the project.

Closing this since the new bridge replaces that code path; if the problem still shows up with WSL hosts on, please open an issue with details.

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.

[Bug]: Folder workspace on a \\wsl.localhost path detects agents on the Windows host — WSL-only agents (Claude, OpenCode) missing from picker

2 participants