Skip to content

test(wsl-host): native chat on a WSL host through the fake transport, including a stopped distro - #34573

Merged
nwparker merged 4 commits into
mainfrom
nwparker/wsl-host-chat-e2e
Oct 27, 2026
Merged

nwparker merged 4 commits into
mainfrom
nwparker/wsl-host-chat-e2e

Conversation

@nwparker

@nwparker nwparker commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​336 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​336
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​52 $\color{#cf222e}{\Huge{\mathbf{−}}}$​13 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​39

ELI5

This adds an end-to-end test that opens a native Claude chat from the desktop on a project that lives on a WSL host. The test checks four things: the chat starts, the reply streams in, the chat refuses cleanly while the distro is stopped (it doesn't quietly start it), and the chat carries on once the user switches back to the project, which starts the distro again.

What Changed

  • New spec tests/e2e/wsl-host-chat.spec.ts. The HUB app stands in for the distro's orcad and runs the existing Claude stub. A second desktop runs with the fake WSL transport (ORCA_E2E_FAKE_WSL_HOSTS, behind ORCA_INTERNAL_WSL_HOSTS). The test then:

    • adds the distro as a host and adds a git project on it;
    • checks that the host answers agentSession.createSupport with supported: true;
    • opens a Claude chat through New tab and sees the stub's reply stream in;
    • marks the distro stopped and checks that chat calls fail with "Ubuntu was stopped…" and nothing tries to start the distro;
    • switches away from the project and back, checks that this one action starts the distro, and sends again until a new reply arrives.

    It saves screenshots of the streamed, stopped and after-start states.

  • Fake connector (src/main/wsl/wsl-host-e2e-fake-connector.ts). A distro that a test marks stopped in distrosFile now drops its bridge and reports stopped. A no-boot reconnect is refused, and a plain connect starts the distro, as wsl.exe would. Fixed listings and specs that never stop a distro behave exactly as before. A unit test pins this behaviour.

Why

Until now, native chat on a WSL host had only been proven at the RPC level on real distros. The desktop's UI path, and how it behaves when the distro stops, had never been run. This spec is new rather than an edit of wsl-host-fake-transport.spec.ts because two open PRs (#34530 and #33911) edit that file. The launch helper is a minimal copy, because the shared one in #33911 isn't on main yet. It should move into that helper once #33911 lands.

Linked Issue

N/A (maintainer).

Visual Proof

The screenshots are saved as test artifacts in the e2e run.

Testing

  • pnpm tc, pnpm run typecheck:ci, pnpm run check:code-quality:changed, oxlint, and pnpm test src/main/wsl/wsl-host-e2e-fake-connector.test.ts pass locally.

  • I didn't run the e2e spec locally because the Mac is heavily loaded. CI's e2e job on this PR is the proof.

  • I manually tested these changes locally

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

Review

Flag-off / user risk: none. These are test files plus the e2e-only fake connector, which is active only under ORCA_E2E_FAKE_WSL_HOSTS.

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

The Claude stub is POSIX-only, so the spec skips on Windows, like the other stub specs.

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 27, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent 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: 74a63025-59f6-4416-aa33-cf7f640c6542
Commits

Reviewing files that changed from the base of the PR and between 40357e0 and 846844d.

Files selected for processing: 4
  • config/scripts/pr-e2e-route-contracts.test.mjs
  • config/scripts/pr-e2e-source-routing.mjs
  • src/main/wsl/wsl-host-e2e-fake-connector.ts
  • tests/e2e/wsl-host-chat.spec.ts

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

Walkthrough

The fake WSL connector now reads distro state from a file and updates stopped distros when a connection can boot them. It reports stopped distros as stopped and removes their active bridges. New tests cover these connector behaviors and a WSL-host chat flow, including rejection while Ubuntu is stopped and reconnection after switching projects.

Priority: Low

Merge Risk: Low · up to 84684

The new WSL chat test still needs the required background-launch setting; this is a bounded test-fixture risk to address before merging.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 22.22% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surv… 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 identifies the main change: native chat testing on a WSL host through the fake transport, including stopped-distro behavior.
Description check Passed The description is detailed and mostly complete. It covers the user-facing behavior, implementation changes, rationale, linked-issue status, visual proof, testing, risk, platform considerations, and c…
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: Description check

Explanation

The description is detailed and mostly complete. It covers the user-facing behavior, implementation changes, rationale, linked-issue status, visual proof, testing, risk, platform considerations, and checklist items. The explicit AI Disclosure heading is omitted, but this is non-critical for a maintainer PR.

Full details: Docstring Coverage

Explanation

Docstring coverage is 22.22% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 9 functions across 5 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: 3


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: b8b200fd-ee99-4b4c-8cea-181db09b99af
Commits

Reviewing files that changed from the base of the PR and between 917ef9c and 40357e0.

Files selected for processing: 3
  • src/main/wsl/wsl-host-e2e-fake-connector.test.ts
  • src/main/wsl/wsl-host-e2e-fake-connector.ts
  • tests/e2e/wsl-host-chat.spec.ts

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

if (!options.isKnownDistro(distro)) {
throw new Error(`${distro} is no longer a WSL host; Orca will not start anything for it.`)
}
if (isStopped(distro)) {

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

Supported by static analysis

Script executed:

#!/bin/bash
rg -n -C6 '\.stopServer\(' src/main/wsl --glob '!*.test.ts'
rg -n -C4 'stopServer' src/main/wsl/wsl-host-connector-contract.ts

Repository: stablyai/orca

Length of output: 1873


Script executed:

rg -n -e 'stopServer' -e 'noBoot' -e 'dropBridge' -e 'isStopped' -e 'connect(' -e 'reachability' src/main/wsl/wsl-host-e2e-fake-connector.ts src/main/wsl/wsl-host-service.ts || test "$?" -eq 1
echo '--- fake connector 60-150 ---'
sed -n '60,150p' src/main/wsl/wsl-host-e2e-fake-connector.ts

Repository: stablyai/orca

Length of output: 3706


Keep stopServer from booting a stopped distro.

When stopServer has no active bridge, it calls connect(distro) with no intent. A stopped distro has no bridge, because reachability calls dropBridge for it. The connect call then takes the boot branch and writes running to distrosFile. The connector contract says stopServer "never boots a stopped distro", and the removal path relies on that. In the fake harness, removing a stopped host therefore starts the distro and leaves it running.

Change stopServer so it does not call connect for a stopped distro. It should return the proven-stop result that the contract describes. This matters only when distrosFile is set. Without it, connect throws instead, and the removal path reports the result as unverifiable.

})
const app = await electron.launch({
args: getOrcaElectronLaunchArgs(path.join(process.cwd(), 'out', 'main', 'index.js'), false),
env: { ...isolation.env, NODE_ENV: 'development', ORCA_E2E_HEADLESS: '1' }

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

Supported by static analysis

Script executed:

sed -n '35,70p' tests/e2e/wsl-host-chat.spec.ts
rg -n 'ORCA_BACKGROUND_LAUNCH|ORCA_E2E_HEADLESS|ORCA_E2E_FOREGROUND' src/main/window/foreground-activation-policy.ts tests/AGENTS.md tests/e2e/AGENTS.md

Repository: stablyai/orca

Length of output: 2711


Script executed:

#!/bin/bash
nl -ba src/main/window/foreground-activation-policy.ts | sed -n '1,80p'
printf '\n--- tests/AGENTS.md ---\n'
nl -ba tests/AGENTS.md | sed -n '1,35p'
printf '\n--- tests/e2e/AGENTS.md ---\n'
nl -ba tests/e2e/AGENTS.md | sed -n '1,35p'

Repository: stablyai/orca

Length of output: 7622


Pass ORCA_BACKGROUND_LAUNCH=1 explicitly to electron.launch().

This E2E fixture is not covered by a window-presentation exception. Although ORCA_E2E_HEADLESS=1 keeps the launch backgrounded by default, an inherited ORCA_E2E_FOREGROUND=1 can override that behavior. The test must satisfy the explicit launch contract.

Proposed fix
--- "a/tests/e2e/wsl-host-chat.spec.ts"
+++ "b/tests/e2e/wsl-host-chat.spec.ts"
@@ -52,7 +52,12 @@
   })
   const app = await electron.launch({
     args: getOrcaElectronLaunchArgs(path.join(process.cwd(), 'out', 'main', 'index.js'), false),
-    env: { ...isolation.env, NODE_ENV: 'development', ORCA_E2E_HEADLESS: '1' }
+    env: {
+      ...isolation.env,
+      NODE_ENV: 'development',
+      ORCA_E2E_HEADLESS: '1',
+      ORCA_BACKGROUND_LAUNCH: '1'
+    }
   })
   forwardElectronProcessLogs(app, testInfo)
   const dispose = async (): Promise<void> => {
Committable suggestion

IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
env: { ...isolation.env, NODE_ENV: 'development', ORCA_E2E_HEADLESS: '1' }
env: {
...isolation.env,
NODE_ENV: 'development',
ORCA_E2E_HEADLESS: '1',
ORCA_BACKGROUND_LAUNCH: '1'
}

Comment thread tests/e2e/wsl-host-chat.spec.ts Resolved
… the fake's route

Find the prompt only in the transcript so the composer can't stand in for it,
re-check the boot-free stop window after unfocusing, right before the focus,
give the fake's distros.json temp file its own name so it can't collide with the
spec's, and test that the fake connector routes to both WSL host specs.
@blacksmith-sh

This comment has been minimized.

@nwparker
nwparker merged commit eb7f4d9 into main Oct 27, 2026
75 of 76 checks passed
nwparker added a commit that referenced this pull request Oct 27, 2026
…topped distro's bridge as closed

Main's fake connector (#34573) now publishes 'closed' when a stopped distro's
bridge drops, not liveness's 'distro-stopped'. So the phone's check reads the
stop under a ready status and doesn't claim it. The phone gets the neutral
copy and unavailableOnDesktop; the confirmed-stop copy stays unit-tested.
nwparker added a commit that referenced this pull request Oct 28, 2026
…topped distro's bridge as closed

Main's fake connector (#34573) now publishes 'closed' when a stopped distro's
bridge drops, not liveness's 'distro-stopped'. So the phone's check reads the
stop under a ready status and doesn't claim it. The phone gets the neutral
copy and unavailableOnDesktop; the confirmed-stop copy stays unit-tested.
nwparker added a commit that referenced this pull request Oct 28, 2026
… sending

Like #34573: the composer must be editable before typing, and hold the typed text before Send.
nwparker added a commit that referenced this pull request Oct 28, 2026
…ed terminal names its host (#34880)

* fix(wsl-mover): a moved project's chat opens and answers here; a fenced terminal names its host

New e2e: a moved project's existing chat still answers after the move, run by this computer's
agent, with no host involved. Writing it surfaced two product gaps:
- Opening the chat from the moved project's sidebar entry asked its composer for focus before
  the prompt editor mounted; tiptap threw and the terminal workbench crashed. The editor handle
  now focuses (and answers contains) only once its view is mounted.
- A new terminal in a project its WSL host now owns (one a chat's agent might ask for) was
  refused with "is moving ... try again when the move finishes". It now names the host and the
  way back: use the project on this computer again.

* test(wsl-mover): wait for the moved chat's composer before typing and sending

Like #34573: the composer must be editable before typing, and hold the typed text before Send.
nwparker added a commit that referenced this pull request Oct 28, 2026
…topped distro's bridge as closed

Main's fake connector (#34573) now publishes 'closed' when a stopped distro's
bridge drops, not liveness's 'distro-stopped'. So the phone's check reads the
stop under a ready status and doesn't claim it. The phone gets the neutral
copy and unavailableOnDesktop; the confirmed-stop copy stays unit-tested.
nwparker added a commit that referenced this pull request Oct 28, 2026
…topped distro's bridge as closed

Main's fake connector (#34573) now publishes 'closed' when a stopped distro's
bridge drops, not liveness's 'distro-stopped'. So the phone's check reads the
stop under a ready status and doesn't claim it. The phone gets the neutral
copy and unavailableOnDesktop; the confirmed-stop copy stays unit-tested.
nwparker added a commit that referenced this pull request Oct 29, 2026
…topped distro's bridge as closed

Main's fake connector (#34573) now publishes 'closed' when a stopped distro's
bridge drops, not liveness's 'distro-stopped'. So the phone's check reads the
stop under a ready status and doesn't claim it. The phone gets the neutral
copy and unavailableOnDesktop; the confirmed-stop copy stays unit-tested.
nwparker added a commit that referenced this pull request Oct 29, 2026
…er starts its distro (E6) (#33911)

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

Behind ORCA_INTERNAL_WSL_HOSTS and the Experimental switch. The desktop relay
lists its WSL hosts to phones. Every relayed call (resolve, call, watchChanges,
status.get) passes a never-start check, and a WSL host serves a phone only
while it already runs.

- WslHostPhoneGate holds the phone's view. The call check reuses E9's
  focusReachability, so with no bridge in this process it refuses without a
  running-list read. A host shows as "stopped" only on a confirmed stop
  (liveness's distro-stopped, or a running list read by the check); anything
  else gets a neutral "isn't available" message. Hosts are hidden from phones
  while the Experimental switch is off or a Remove is pending.
- The relay host list sends optional `stoppedOnDesktop` only for a confirmed
  stop. The phone badges those rows "Start on computer"; older peers ignore
  the field.
- The paired-server rows producer carries WSL hosts like any server, so the
  main-computed sidebar feed a phone reads has their rows.
- The paired-phone e2e drives a WSL host project end to end and asserts a
  stopped distro is never started.

* fix(wsl-host): keep the phone's no-start check off non-WSL servers, and a stale stop off a ready host

- status.get runs the no-start check only for a WSL host, through a
  check-only helper. SSH-managed and paired servers reach the status owner
  exactly as on main: no reconnect, no redeploy, and the manual-disconnect,
  coalescing and repair handling stay in place. The preparation option is
  stripped before the probe.
- WslHostPhoneGate drops a 'stopped' read when a ready status arrived while it
  ran (a per-host ready generation), and clears a recorded stop when a check
  finds the host answering.
- A phone asking about a host that is switched off or being removed gets copy
  that says so, not "open one of its projects".

* test(wsl-host): the real no-start helper leaves SSH-managed and paired servers untouched

* fix(wsl-host): tie a phone's confirmed WSL stop to that host's status, and label a host not connected

- A stop a phone's check confirmed is stored with that host's own status
  object and holds only while that status is current. Another host's change no
  longer clears it. Any status of its own (ready, a disable's closed, a failed
  Remove's closed) does. A read never records a stop over a ready status, so a
  read shared with one begun before ready can't. Removed hosts drop their
  entry. The generation map and status listener are gone.
- The relay sends optional `unavailableOnDesktop` for a WSL host this desktop
  isn't connected to and doesn't know is stopped. New phones badge it "Open on
  computer"; older ones still show Connecting.
- The relay list reads the WSL host records once per poll (reachAll).

* refactor(wsl-host): one records read per phone check; note the gate's status identity compare

* test(wsl-host): read the phone's host flags as booleans in the paired-phone e2e

toMatchObject({ stoppedOnDesktop: undefined }) requires the key to be
present, and the desktop omits an unset flag, so the ready poll could never
match. The poll now compares relay plus both flags read as booleans.

* test(wsl-host): expect the neutral refusal once main's fake drops a stopped distro's bridge as closed

Main's fake connector (#34573) now publishes 'closed' when a stopped distro's
bridge drops, not liveness's 'distro-stopped'. So the phone's check reads the
stop under a ready status and doesn't claim it. The phone gets the neutral
copy and unavailableOnDesktop; the confirmed-stop copy stays unit-tested.

* test(wsl-host): the paired-phone e2e expects the confirmed stop again, and checks nothing booted the distro

Main's fake now publishes 'distro-stopped' when it drops a stopped distro's
bridge (#34624), as liveness does, so the phone gets "isn't running" and
stoppedOnDesktop. The spec also checks distros.json still reads 'stopped' at
the end: the fake boots a distro by rewriting it.

* test(wsl-host): the startup reconcile suite stubs the phone gate built beside the service

The reconcile still runs before the connector exists; the suite only lacked the new
setWslHostPhoneGate export on its service-instance mock.

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

---------

Co-authored-by: Claude <[email protected]>
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