Skip to content

feat(mobile): let paired phones use chats on WSL hosts - #28972

Closed
brennanb2025 wants to merge 9 commits into
mainfrom
brennanb2025/wslchat-pr10
Closed

brennanb2025 wants to merge 9 commits into
mainfrom
brennanb2025/wslchat-pr10

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​249 $\color{#cf222e}{\Huge{\mathbf{−}}}$​15 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​234
Prod 13 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​448 $\color{#cf222e}{\Huge{\mathbf{−}}}$​221 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​227

ELI5

A paired phone cannot use chats on a WSL host because the desktop deliberately excludes those hosts from its relay, and WSL reconnects only for work visible on the desktop. This lets the phone open and send to those chats through its paired Windows desktop, even when that project is offscreen.

What Changed

WSL hosts join the existing configured-server relay behind the existing internal and Experimental gates. Explicit workspace Open, chat create/Send/resume/subscribe, and image-upload requests can acquire host demand; catalog, status, host-wide subscriptions and history reads acquire none. The demand belongs to the phone's relay connection and releases on failure, retirement or disconnect. Desktop-visible work and phone work feed the same WSL reconnect policy.

WSL preparation keeps the configured server registration and signing key fixed while allowing bridge credentials to refresh, then the relay reads the current pairing identity. A removed or replaced server cannot inherit an action already preparing. Established connections keep the existing environment/pairing identity, delegated-phone capability check and retirement fencing; late frames from retired connections are dropped. The phone uses the desktop relay throughout, with no guest endpoint exposed to it and no new wire fields or stream operations.

Neil-owned files extended: src/main/wsl/wsl-host-service.ts and its existing test; new src/main/wsl/wsl-host-work-demand.ts holds connection-scoped demand. No mover changes.

Why

The existing relay already owns host routing, delegated phone credentials, uploads and session streams. Extending its connection lifetime and the host's existing demand policy keeps execution on the owning host, with explicit work allowed to wake it. Intended difference: WSL remains reachable through the Windows desktop because that desktop owns its managed transport; desktop-closed connectivity is unavailable. No separate phone-to-guest transport or Windows-owned provider process is added.

Linked Issue

WSL native chat plan, PR 10; extends the phone exclusion introduced by #27933.

Visual Proof

Pending Windows Q7 evidence. No new UI surfaces; existing phone workspace and chat screens use the host relay.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Contract coverage: passive requests do not acquire wake demand; explicit phone work reconnects an offscreen host; overlapping phone leases release independently; reconnect finishes before pairing resolution without accepting a replacement server; retirement releases demand and discards late frames. Existing relay tests cover delegated-device capability refusal, phone revocation, terminal streams and connection loss; image/approval/attention behavior still needs Q7 proof.

Local git diff --check passed. On commit 2ffd244ff4788b22782bf5f611af3fbabb78b71b, PR Checks run 38677462926 passed the full static-analysis/typecheck job, all five unit shards, relay integration, Linux/Windows packaging and the PR checks passed aggregate. No local heavy checks ran under the shared-machine policy. The deprecated remote-typecheck helper exited before running any checks or creating a worktree.

Q7 handed to the coordinator for Windows high spec: keep the guest project offscreen; repeated host/status/catalog lists must leave a stopped disposable distro stopped; explicit phone Open/Send starts it; exercise stream, image, approval/question, Stop, history/resume, one completion/attention notification and ACK; desktop loss/re-pair invalidates old streams. Real paired-phone proof is pending; if unavailable, run the relay contract with the repo's mobile emulator path and retain the real-device step as pending.

The separate real-WSL lane failed before tests: the runner already reports WSL 3.0.1, but its install step exits with MSI 1603. This shared runner-setup failure is assigned to the workflow-fix lane; no workflow changes are included here.

AI Disclosure

Review

Self-review includes SSH and folder-workspace routing, unchanged old-peer capability checks, availability gates, pairing rotation and lease cleanup. No new protocol capability is needed because the demand API is desktop-local and optional.

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 desktop must remain reachable. Host status still comes from the existing execution-host authority; contact loss is not process exit.

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)

@brennanb2025

brennanb2025 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor Author

Paired phones could not open chats on a stopped WSL host because the desktop did not relay phone work into the host’s reconnect policy. After a desktop restart, the phone could also lack a saved project row to tap, and a phone action joining a connection already opening could lose its request during a bridge refresh.

At 66968e6d6ae5918cde34eb90388d210d2a09364b, the phone can show path-bearing projects from the desktop’s saved host session and wake the configured host through the existing Open action. Passive listing stays passive. Pending work stays tied to the original configured server while using its current bridge credentials, and sleeping-agent guidance points to the existing agent tab. Unknown inventory preserves phone-cached rows; a successful empty fetch remains authoritative.

Round 2 is complete: correctness, lifecycle and readiness source reviews agree with the fixes. Their single catalog regression was corrected and checked against the rule that an unreachable host must not erase saved phone rows. Controlled source probes covered sixteen relay schedules and five catalog scenarios; these are not the test suite or real UI proof. The existing startup recordings now match the sleeping-agent guidance, and the link data class/types moved unchanged into a focused module for the file-length check. Mobile CI passed 10,239 tests (6 skipped), including all recording/replay assertions, plus typechecks. Its lint job is blocked by an unrelated chat-view test file on main exceeding its line limit. The full PR workflow’s typecheck and changed-code quality checks passed, but lint also found an unrelated Git test over its line limit; this PR changes neither test file. The browser bundle job hit an HTML-preview navigation timeout in unchanged code, and desktop test shards were skipped after lint failed. Green current-head CI and coordinator-owned Windows/phone QA with screenshots remain required, so this PR is not ready to merge.

Intended: the paired desktop must remain reachable, and explicit work demand lasts until the phone relay disconnects. Temporary limitation: a stopped host’s opaque folder workspaces need existing desktop-readable path facts to appear after a cold restart; they become available after reconnect. No new saved inventory or reconnect control was added.

For Brennan’s review

Before/after screenshots for cold-start Open and sleeping-agent tab wake are still pending coordinator-owned Windows/phone QA. The late-demand timing also needs the deterministic regression checks; a screenshot cannot establish that race.

  • Saved project rows: restores only projects the desktop can already reconstruct; opaque folder rows remain the temporary limitation above.
  • Opening a host connection: an Open action joining passive work waits for host preparation, then connects to the original configured host using its current credentials.

@OrcaWin

OrcaWin commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator

Windows QA for head a9790d2 (Windows high spec, real signed-in Claude Code 2.1.302 inside a throwaway WSL2 distro, Codex driving the UI over CDP)

Batch 3 (this run):

  • Step 3 BLOCKED (the phone keeps cached rows when there are no saved sessions, and an empty inventory clears them): there is no Android emulator, SDK or adb on this machine, so the Orca phone app could not run. Nothing was installed to work around it.
  • Step 5 BLOCKED (a sleeping headless agent tab shows on the phone, and tapping it resumes the real agent): same reason.

Earlier batch-2 results on this same head (phase 6). These used a scripted phone client paired over the local network instead of the real phone app, with scripts instead of a driver model:

  • Step 1 FAIL, but the desktop broke the precondition, not the phone (cold desktop restart with saved WSL rows while the phone only reads): the distro was stopped at relaunch, but about 1 second after the cold start the test desktop itself booted it, before any phone traffic. The phone's reads themselves were fine: the host row and both saved workspace rows came back, and a process list on the host was refused with a plain "isn't answering; connect it again in Settings" message. On a retry, the desktop booted the distro again while it was shutting down.
  • Step 2 PARTIAL (opening and sending from the phone wakes the distro and the chat answers): open worked, the chat was created and Claude answered "P6-PHONE-WOKE". The wake itself could not be isolated, because the desktop rebooted the distro after every shutdown before the phone acted.
  • Step 3 NOT RUN in batch 2: the scripted client has no cache.
  • Step 4 PASS (a request that arrives while the distro is shutting down reaches the restarted server): the in-flight history request answered, and after the restart, status calls reached the new server 3 out of 3 times with no stale-host error.
  • Step 5 NOT RUN in batch 2: it needs the phone UI.

No screenshots: batch 3 could not run the phone app, and the batch-2 scripted phone has no screen.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Superseded by #33911.

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.

2 participants