Skip to content

fix(mobile): detect New Workspace agents in the selected repo runtime - #31351

Merged
nwparker merged 6 commits into
mainfrom
nwparker/mobile-wsl-agents
Oct 22, 2026
Merged

nwparker merged 6 commits into
mainfrom
nwparker/mobile-wsl-agents

Conversation

@nwparker

@nwparker nwparker commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​387 $\color{#cf222e}{\Huge{\mathbf{−}}}$​8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​379
Prod 10 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​273 $\color{#cf222e}{\Huge{\mathbf{−}}}$​206 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​67

Current risk review

Merge risk: Low. The earlier controlled catalog/selector boundary is now closed. At this exact head, the real Store + ProfileStateSqliteAuthority flush/close/reopen a SQLite catalog and feed the full OrcaRuntimeService, protected selector, request schema, RPC handler and detector on native Windows Node v24.18.0 / actual Ubuntu. Native repo detects claude, codex, opencode, omp, prime-agent, droid, grok; selected WSL repo detects claude, prime-agent, kimi and excludes mounted Windows commands. UNC git and folder targets resolve Ubuntu despite a persisted Windows-host default. Untrusted path/distro/host hints are stripped. A persisted owner change during lookup refuses repo_target_changed; later lookup and another SQLite reopen refuse the foreign runtime. Unknown IDs refuse; legacy untargeted calls stay local. The same full persisted-runtime fixture passes the non-Windows branch on macOS. The 4,749-module exact-source bundle hash and exit 0 are verified on Windows; owned profiles/directories/PTYS were removed/closed. This supports lowering risk from low–medium to low. Electron process APIs are fixture-stubbed; the patched shared service was not deployed/restarted. Older installed hosts safely accept additive repoId but need an update for selected-WSL parity.

All five remaining exact heads combine cleanly on reviewed main d15677e334b01d345266b387252f68b47f35f038 as a604c0599c29bb6e108156edb8381676a0cee889. 519 mobile tests / 37 files and 194 desktop tests / 8 files pass, including upstream reading-place, async prompt/send and paste-drop coverage; full mobile lint, production types (1,883 roots) and the unchanged 118-file test diagnostic baseline (2,989 roots, no additions/stale entries) pass. Production bundle integrity/reproducibility/size pass (130 assets; 8,607,138/9,437,184 budgeted bytes). This uses existing installed dependencies: newer-main dependency upgrades were not installed. The committed WebView declaration patch is applied only in compiler memory. Exact head CI and aggregate gate pass; skipped jobs remain separate. No product code/head or shared service/dependency changed in this pass. All manual work remains together at the end.

ELI5

When you choose a repository inside WSL on your phone, Orca should look for agents inside that repository’s Linux environment. New Workspace instead asked Windows which agents it had. Both workspace creation screens now name the selected repository so its host can look in the right place.

What Changed

  • Pass the selected repo to agent detection in New Workspace and the Tasks workspace draft.
  • Resolve the repo’s owning host and runtime through existing host-side workspace detection, including project preferences and WSL share paths. Refuse malformed stored owners through the shared strict ownership resolver.
  • Hide stale agents while the modal switches repositories or host clients, including identical repository IDs on different paired hosts.
  • Refuse a repo target if its catalog row disappears, becomes duplicate, or changes path/ownership across the async selector; never combine an old path with a new owner. A repo target without a store also refuses. Legacy no-target/workspace fallback stays unchanged.
  • Extract runtime target resolution to keep the terminal authority module within the existing size gate.

Why

A workspace does not exist yet during creation, but the source repo already does. Using its host-owned record preserves project runtime preferences, remote ownership checks, and the existing WSL parser.

This follows the New Workspace investigation in community PR #20101 by @welldoingk, adapted to the current host-resolved contract. The commit includes Co-authored-by: welldoingk <[email protected]>.

Linked Issue

Fixes #20060

Visual Proof

Source-built Release iPad simulator, current production hosted web shell, production E2EEv2 transport. Same fixture/server key and selected WSL repository; only the production web bundle changes between sessions. Every screenshot below was visually inspected.

Only OpenCode is enabled in the isolated fixture settings. The actual Windows host PATH lacks it, while the actual Ubuntu-24.04 WSL repository has it. Before: Blank Terminal only. After: OpenCode is available and selected by default in both workspace creation flows.

New Workspace Before After
Selected repo and default agent (screenshot removed: contained real product data) (screenshot removed: contained real product data)
Actual agent menu (screenshot removed: contained real product data) (screenshot removed: contained real product data)
Tasks draft agent menu (screenshot removed: contained real product data) (screenshot removed: contained real product data)

Validation boundary: the live awin host predates this change, so a fixture adapter translates the new known repoId to that repository’s existing worktreeId for real WSL agent detection. Baseline requests omit the target and probe the real Windows PATH. Host unit tests independently verify the new repository resolver; this does not claim the host patch is deployed to awin. No workspace was created.

Testing

  • 24 focused mounted mobile tests: both loaders, paired-server routing, repository switching, folder selection, SSH connection gating, and late success/error replies after repository or host changes.
  • 1,616 targeted modal, RPC recording, and page-bridge parity tests after CI follow-up: preserved omitted params on no-target calls and regenerated only the intended Tasks repo-target pilot/matrix recordings.
  • 38 focused host runtime/RPC/shared-resolver tests: WSL UNC paths, project overrides, platform runtime parity, legacy/unified SSH ownership, unknown/ambiguous/foreign/malformed owner refusal, legacy requests, and input validation. Both malformed-owner regressions failed before the fix.
  • Repository-host raw-read ratchet passes after using the canonical routing accessor in the snapshot fence; the affected connection-change regression passes again. No baseline exception.
  • Six additional focused real-runtime regressions: catalog deletion, path/owner/connection replacement, duplicate insertion across the actual selector await, and targeted no-store refusal. Five mutation cases fail on the prior head and pass with the guard.
  • Mobile application typecheck; 17,241-file host typecheck; changed-code quality; formatting; RPC catalog verification.
  • Actual Windows host awin, Ubuntu-24.04: WSL agent detection differs from Windows PATH. An older host accepts the new optional repo field, ignores it, and retains its existing behavior.
  • Native iPad simulator: actual New Workspace and Tasks draft agent menus before/after, production hosted web shell over E2EEv2, screenshots visually reviewed.

Mobile application typecheck, the 1,064-file mobile test-typecheck ratchet, the 17,241-file host application/test typecheck, changed-code quality, and formatting pass. Full applicable lint/build/test CI and aggregate gate now pass at the exact final head.

Review

Root independently reviewed the host-resolution extraction and repo target reuse. A second adversarial boundary review found a malformed stored owner could normalize to a local probe; removing the synthesized owner restores the shared strict resolver’s refusal. Root accepted that minimal fix, and its before/after regressions pass. A later timing review added a narrow post-await snapshot check for the new repository target. Existing shell detection is asynchronous; this check guarantees a consistent target at host resolution and does not lock repository settings throughout an external probe or launch. SSH continues using its existing request. Existing worktree/folder-workspace resolution and no-target requests retain their behavior. The optional field is stripped by current older schemas, and oldest no-param hosts discard request params. Host records resolve paths, project preferences, and ownership; the phone cannot inject a distro or shell command.

Agent skill upstream boundary

  • Not applicable: no skill installer source copied or translated.

Notes

Platform-specific runtime selection stays in the existing host resolver. macOS, Linux, Windows, folder workspaces, and paired hosts continue using that shared resolution.

Checklist

  • Focused fix with ELI5 and mechanism explained.
  • Before/after screenshots attached and visually reviewed.
  • Reviewed correctness, security, performance, cross-platform behavior, and remote compatibility.
  • Relevant local checks passed; broader gates covered by CI.

Additional exact-head platform validation on real Windows/Ubuntu uses the production resolver, request schema, RPC method and detector at 06fd6864e695. Native Windows returns seven agents; the selected Ubuntu repo returns claude, prime-agent, and kimi, excluding Windows-mounted Codex/OpenCode commands. Deletion/path/owner/connection/duplicate mutations across the selector await and malformed/foreign/unserved owners refuse. Five production source hashes match Git. The catalog and selector are controlled fixture boundaries; this does not claim a patched service deployment. A separate live older-runtime probe safely accepts the additive parameter but retains its Windows-default list, so selected-WSL parity still needs a host update. Owned temp files and the test terminal were removed; shared services/dependencies were untouched.

Pass the source repo to both New Workspace detection paths before a worktree
exists. Resolve its owning host and project runtime with the existing host-side
workspace logic, including WSL paths and Windows project preferences.

Retain host-default requests for old clients, SSH routing, and ambiguity refusals.
Clear the modal agent results when switching source repos.

Inspired by the New Workspace follow-up in community PR #20101, adapted to the
current host-authoritative detection contract.

Co-authored-by: welldoingk <[email protected]>
@nwparker
nwparker marked this pull request as ready for review October 21, 2026 04:04
@coderabbitai

coderabbitai Bot commented Oct 21, 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 4 minutes.

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
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c9b152b9-5054-4abd-89e8-95854a593cf8
📥 Commits

Reviewing files that changed from the base of the PR and between 411b5c0 and 06fd686.

📒 Files selected for processing: 15
  • mobile/rpc-foundation/goldens/matrix-tasks.workspace-ssh-local-preflight.detectagents-1.json
  • mobile/rpc-foundation/goldens/tw-workspace-ssh-local-agents.json
  • mobile/rpc-foundation/pilot-scenarios.json
  • mobile/src/components/NewWorktreeModal.test.tsx
  • mobile/src/components/NewWorktreeModal.tsx
  • mobile/src/components/use-new-workspace-execution-target.test.tsx
  • mobile/src/components/use-new-workspace-execution-target.ts
  • mobile/src/tasks/use-mobile-tasks-workspace-create-server.test.tsx
  • mobile/src/tasks/use-mobile-tasks-workspace-ssh-state.tsx
  • src/main/runtime/agent-detection-host-resolution.test.ts
  • src/main/runtime/rpc/methods/preflight.test.ts
  • src/main/runtime/rpc/methods/preflight.ts
  • src/main/runtime/runtime-agent-detection-host.ts
  • src/main/runtime/terminal/output/terminal-orchestration-authority.ts
  • src/shared/rpc-contract/preflight-params.ts
  • 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
nwparker marked this pull request as draft October 21, 2026 04:47
@nwparker

Copy link
Copy Markdown
Contributor Author

Adversarial follow-up found a new repo-target boundary to tighten before merge: malformed repository ownership metadata can normalize to local when the repo route synthesizes hostId. The focused fix will let the existing strict ownership lookup validate the stored row and refuse malformed owners. Reproduction and additional host/repository switch races are being validated. Temporarily marked draft until the amendment is reviewed and pushed.

@nwparker
nwparker marked this pull request as ready for review October 21, 2026 04:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug][Mobile]: Create-workspace surfaces list no agents for a WSL-hosted repo (detectAgents sent without a distro)

1 participant