Skip to content

fix(wsl): offer the existing host when adding a folder from a distro that already runs as one - #37377

Merged
nwparker merged 2 commits into
mainfrom
fix/wsl-offer-existing-host
Nov 2, 2026
Merged

nwparker merged 2 commits into
mainfrom
fix/wsl-offer-existing-host

Conversation

@nwparker

@nwparker nwparker commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​204 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​204
Prod 16 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​222 $\color{#cf222e}{\Huge{\mathbf{−}}}$​27 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​195

ELI5

When you pick a \\wsl.localhost\<distro>\... folder and that distro already runs as a WSL host, Orca now asks whether to add the project on that host (recommended) or keep it on Windows, instead of silently adding it on Windows.

What Changed

  • Before: with WSL hosts on and the distro already a host, picking a folder from \\wsl.localhost\<distro>\... in Add Project added it as a Windows project reaching across the file share, with no offer. The "Run as a host" offer only appears while the WSL hosts setting is off, so this case got nothing.
  • After: the dialog shows "Add on the host (recommended)" with Add on host and Add on this computer.
    • Add on host switches the dialog to that host and fills in the Linux path. This is the same step a sidebar drop of that folder already lands on, so the user confirms with Add. If the host isn't selectable yet (its distro is stopped), it uses the dialog's existing Connect action. That is a user click, so starting the distro is allowed. Nothing passive starts it.
    • Add on this computer adds it on Windows as before.
  • Mechanism: the offer hook first checks the saved WSL hosts (the same list and routing the sidebar drop uses), then falls back to the existing run-as-host offer. A \\wsl.localhost\<distro>\mnt\c\... path is a Windows drive seen through the distro, so it gets no offer, matching drops.

Why

Sidebar drops already send such folders to the existing host. The folder picker took the old Windows path because the offer is gated on the setting being off. The fix reuses the drop routing and the dialog's own host-path prefill rather than adding a new add path. Declining is not remembered: every add from a host's distro offers the host. That is deliberate, because the host is the recommended home for those folders.

Linked Issue

Found on a Windows test build (v1.4.246-adhoc).

Visual Proof

Not captured: needs a Windows desktop with a WSL host. The notice reuses the layout and primitives of the existing offer.

Testing

  • use-add-repo-wsl-host-offer.test.tsx (new) covers four cases: the existing-host offer replaces the run-as-host offer; Add on host selects the host and hands over the Linux path; a host that can't be selected is connected through the existing Connect action; Add on this computer adds the Windows path.

  • wsl-host-offer.test.ts covers the routing: a matching distro (any casing), another distro, a drvfs path, a Windows drive, and no hosts.

  • Gates: pnpm tc, pnpm typecheck:ci, pnpm run check:code-quality:changed, oxlint, and the localization verifiers all pass.

  • I manually tested these changes locally

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

Risk

Renderer-only change in the Add Project dialog. It applies only on a Windows desktop with WSL hosts available, the setting on, a saved host for that distro, and "This computer" selected. SSH, paired hosts and folder workspaces are unaffected: the host-path step adds folders as well as repos. Back out with a plain revert.

Level: Low

Notes

Flag-off / User-risk: with the WSL hosts setting off (the default) nothing changes, because the saved-host list is empty and the old offer path runs.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I stated the risk
  • Before/after screenshots (see Visual Proof)
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered

@nwparker
nwparker marked this pull request as ready for review November 2, 2026 06:52
@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 53 seconds.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

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: a8e9c71c-2657-45bb-8961-ff930d13ad97
Commits

Reviewing files that changed from the base of the PR and between 4343dc2 and faed68a.

Files selected for processing: 18
  • src/renderer/src/components/sidebar/AddRepoDialog.tsx
  • src/renderer/src/components/sidebar/AddRepoExistingWslHostOffer.tsx
  • src/renderer/src/components/sidebar/use-add-repo-host-selection.ts
  • src/renderer/src/components/sidebar/use-add-repo-wsl-host-offer.test.tsx
  • src/renderer/src/components/sidebar/use-add-repo-wsl-host-offer.tsx
  • src/renderer/src/components/sidebar/wsl-host-offer.test.ts
  • src/renderer/src/components/sidebar/wsl-host-offer.ts
  • src/renderer/src/i18n/locales/de.json
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/pt.json
  • src/renderer/src/i18n/locales/ru.json
  • src/renderer/src/i18n/locales/tr.json
  • src/renderer/src/i18n/locales/zh-Hant.json
  • src/renderer/src/i18n/locales/zh.json
  • 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

…ep the offer when the host fails to start

- Translate existingTitle/existingWhy/existingAccept into every locale.
- A drop onto the open dialog after "Add on host" now prefills the dropped path.
- A failed host start keeps the offer so the user can retry or add on this computer.
- Tests run the real saved-host read (flag off gives the run-as-host offer) and the
  offer-to-prefill wiring.
@nwparker
nwparker merged commit f358f42 into main Nov 2, 2026
42 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