Skip to content

feat(wsl-host): a paired phone reaches the desktop's WSL host, and never starts its distro (E6) - #31490

Closed
nwparker wants to merge 1 commit into
mainfrom
nwparker/wsl-host-mobile-relay
Closed

nwparker wants to merge 1 commit into
mainfrom
nwparker/wsl-host-mobile-relay

Conversation

@nwparker

@nwparker nwparker commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​539 $\color{#cf222e}{\Huge{\mathbf{−}}}$​101 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​438
Prod 11 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​207 $\color{#cf222e}{\Huge{\mathbf{−}}}$​29 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​178

Stacked for owner review — do not merge. Prototype for E6 (phones and WSL hosts). Everything new runs only behind ORCA_INTERNAL_WSL_HOSTS, except the shared paths listed below.

Summary

A phone paired with a Windows desktop can now see and use the projects on that desktop's WSL host (the Orca server running inside a WSL distro), the same way it already uses a managed SSH host: list them, open files, run terminals and launch agents, all relayed through the desktop. A tapped push for an agent on the WSL host opens it there.

The one hard rule: a phone never starts a stopped distro. If the distro isn't running, the phone is told "The WSL host Ubuntu isn't running. Open one of its projects on your computer to start it."

Before / after

  • Before: WSL hosts were deliberately hidden from phones. Their projects simply didn't exist on the phone, and a push for an agent there bounced.
  • After (gate on): the phone lists the WSL host next to the desktop's other servers, marked startsOnDesktop. While the distro runs, everything works through the relay. While it's stopped, the host lists as unavailable and every call is refused with the message above; nothing starts.

Mechanism

  • Why they were hidden: every relayed call goes through resolveManagedRuntimeEnvironment, whose WSL branch connects the host when the desktop has open work for it. A phone's call could therefore boot the distro.
  • The fix: relayed calls (resolve, call, watchChanges) pass { wslStart: 'never' }. For a WSL host that runs requireRunningWithoutStart, which serves only if the host is reachable without starting anything (it reads wsl --list --running), and otherwise throws remote_runtime_unavailable with the message above. This holds even while the desktop itself has open work for the host.
  • Listing: a WSL host's last status counts only while the WSL service reports it connected, so a stopped distro lists as unavailable, not a stale ready. The new startsOnDesktop field is optional; older phones ignore it and already fall back to unavailable for anything they don't understand.
  • Desktop sidebar unchanged: the desktop's paired-server rows producer gets a view of the relay hosts without its own WSL hosts (it lists those itself); phones read a WSL host's rows with an on-demand fetch instead.

Shared paths touched (why this needs owner review)

  • callRuntimeEnvironment / subscribeRuntimeEnvironment / resolveManagedRuntimeEnvironment gain an optional preparation argument. Without it, behavior is identical.
  • The mobile relay hosts for all servers now pass that argument. For SSH and paired servers it does nothing.
  • runtime-rpc-pairing.ts: the desktop sidebar's paired-server rows producer is attached to a filtered host view; the phone catalog's row source is a small router (WSL hosts on demand, everything else unchanged).

Why this approach

The relay, delegated phone devices, rows, terminals, agent launch and push routing already work for managed SSH hosts and are the same server code. The only WSL-specific risk was waking the distro, so the change is one "never start" switch on the relay's call path, not a parallel phone path. An explicit "start it from your phone" was left out on purpose; if wanted later it should be a prompt on the desktop, never a silent start.

Testing

  • Unit: relay hosts (gate closed hides WSL hosts; gate open lists them; no-start preparation on every path; status only while connected), managed-tunnel no-start branch, requireRunningWithoutStart (refuses and never calls connect, even with the desktop's open work), catalog startsOnDesktop, the sidebar/phone row split, and the push host id for a WSL worktree. 131 tests pass in those suites.
  • E2E tests/e2e/wsl-host-paired-phone.spec.ts (fake WSL transport, a second Orca standing in for the distro's server): the phone lists the host, lists its project, reads a directory, creates a terminal and launches an agent there; then the distro "stops", the phone's call is refused with the message, the host lists unavailable, and the fake logs no new start. Passes locally, along with the existing wsl-host-fake-transport.spec.ts (that spec needs a non-symlinked TMPDIR on macOS; unrelated, pre-existing).
  • pnpm tc:node, the e2e typecheck for the touched files, and check:code-quality:changed pass.

Not done

  • Phone UI copy for startsOnDesktop ("Start it on your computer"); today the phone shows a generic unavailable host.
  • A real-device check on Windows with a real phone.
  • The main-computed phone sidebar feed (behind the sidebar-inputs build switch) doesn't include WSL host rows; the phone's host list does.

…ver starts its distro (E6)

Behind ORCA_INTERNAL_WSL_HOSTS. The desktop relay now lists WSL hosts to phones,
marked startsOnDesktop, and every relayed call prepares the host with
wslStart: 'never': a WSL host serves a phone only while it already runs. The
desktop sidebar's paired-server rows keep excluding its own WSL hosts; phones
read their rows on demand.

Co-Authored-By: Claude <[email protected]>
@nwparker

Copy link
Copy Markdown
Contributor Author

Superseded by #33911, which rebases this prototype onto current main and finishes the phone copy, the sidebar feed and the never-wake checks.

@nwparker nwparker closed this Oct 26, 2026
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