Repository navigation
feat(mobile): create workspaces on the desktop's servers from the phone - #26533
Conversation
… specs Later phone-mirror slices need one oracle that drives a real mobile-scoped device with the phone's own capabilities against a serve host or a paired desktop. Pins #26022 across a serve restart and today's gap: a desktop's phone does not list the desktop's server workspaces. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Rows on an SSH host the desktop cannot reach looked healthy on the phone. The badge now
adds the desktop sidebar's own word ("devbox · Disconnected"), derived by the same shared
function from the connection status ssh.listTargetSummaries already sends; old desktops keep today's badge.
Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Slices need one composer for host, desktop and phone with a single teardown, so specs stop copying setup. The serve-restart spec now reads the first tab-stream snapshot after the cold start, which is what the phone builds its tab strip from. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
The desktop card shows SSH status on any host count, so the phone now reads target summaries whenever a repo is on SSH and badges an unhealthy host alone too. Labels and health share one target-to-host keying, and a hook-level test pins the reply-to-row wiring. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Teardown failures become a test attachment instead of replacing the real failure, and the cold-snapshot poll reports stream errors together with the PTY list. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…e dot
A catalog that no longer spans hosts or holds an SSH repo now clears the health and label maps,
so a host that left cannot keep badging rows. The badge gets a screen-reader label ("devbox,
Disconnected") instead of reading the middle dot.
Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…mobile devices A desktop paired to this runtime can now call pairing.delegatedMobileDevice.sync to make each of its phones an ordinary mobile-scope device it owns, so the phone mirrors that host through the desktop. Children are never pending, inherit the parent's reach, and die with the parent's grant. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…atch Dispatch binds the caller-bound delegated-device context, so the revoke path it needs now lives in a layer under it as a pure move; this drops the abstract method seam. No behaviour change. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…oked A failed child cleanup now leaves the parent in place so a retry can still find the children, and revokeRuntimeAccess lives beside the revoke it cascades to. Adds restart, rename and bounds coverage, shares credential minting, and drops the timing-dependent census. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…oked Matches the parent revoke: a child whose cleanup could not be saved is kept and the sync errors before minting anything, so the desktop retries instead of believing the server matches its list. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…h the desktop A phone mirrors its desktop, including workspaces on the desktop's configured servers. The desktop now forwards a request that names `executionHost: runtime:<env>` to that server over one socket per (phone, server), signed in as the phone's delegated device; replies pass through untouched except stream ids. Hidden until the phone client ships: the relay capability is not advertised yet. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
… tsc passes Fixtures hoisted into consts widened their health maps to string, which the now-required hostHealthById rejects under the tests-typecheck ratchet; passing them inline keeps the union. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…p-mobile-relay Takes S1a's contract file verbatim (plural capability name) and moves the unpair re-sync into its RuntimeRpcMobileDevices; the relay integration test now syncs against the real server. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
main dropped docs/reference, so the relay's contract lives beside the code. Also pins that a server whose delegated sync fails (e.g. delegated_device_revoke_failed) is unavailable until a later request syncs it again. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
The production hosts adapter was only typechecked; this pins that it resolves configured servers by exact id only (never a name or a removed server), fences by pairing revision and runtime identity, and stops reporting retirements once unsubscribed. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
The settled metadata state now carries hostHealthById, and an SSH-only catalog now reads the target summaries so a lone unhealthy host can be badged. Scoped re-record via rpc-recording.mts. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Reuses the shared E2EE socket opener, folds relay state into fewer fields, never sends a request whose link ended while opening, passes failure codes through, relays only this desktop's own phones, and drops the unused host-state reader until S2 needs one. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Restores the 8 MiB frame cap on every remote runtime socket, re-checks an update-needed server on each new link so an in-place upgrade relays, answers a phone the server just declined without syncing again, and ends a link whose mirrored capability update cannot be queued. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
The phone tags every call on a workspace screen with its execution host, so a paired-desktop method carrying `runtime:<env>` now runs locally instead of failing 'forbidden'. The Mac stays the only reader of the routing table. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…rkspace rows for the phone The phone needs the same host list the desktop shows, including servers that are offline or too old to relay to. mobileRelay.hosts.list/worktrees answer from the desktop's own status and its own worktree.ps fetches, cached per server and fenced by pairing, never from relayed replies. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
… side effect on listing The phone now always lists a server's rows through mobileRelay.hosts.worktrees, so the desktop's own fetch is both the live source and the cache, and stamping stays in main. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
… forget removed servers The desktop now asks for the phone's full-catalog limit, answers within 5s with the last rows when a server hangs, drops a server's rows when it is removed or re-paired, and checks the server's identity after the fetch so a reply from before a re-pair is never served. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
A phone reaches a server's workspace through its desktop only if each call names the host; the direct, cloud-relay and shell-bridge transports now carry `executionHost`, streams keep it for replay and unsubscribe, and an older shell (no `executionHost` grant) refuses rather than strips it. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…de rows mid-delete A server Orca manages on an SSH host now lists once under that host's name, or not at all while the host is reached over the SSH relay, using the sidebar's own folding. Rows the server is deleting are left out at reply time, as a phone asking the server itself would see. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
# Conflicts: # mobile/src/mobile-web-shell/bridge-host-init.test.ts # mobile/src/mobile-web-shell/bridge-host-native-verbs.test.ts # mobile/src/mobile-web-shell/bridge-host-stream-frames.ts # mobile/src/mobile-web-shell/bridge-host-subscriptions.ts # mobile/src/mobile-web-shell/bridge-host.ts # mobile/src/mobile-web-shell/bridge/bridge-client-errors.ts # mobile/src/mobile-web-shell/bridge/bridge-client-subscriptions.ts # mobile/src/mobile-web-shell/bridge/bridge-envelope.ts # mobile/src/mobile-web-shell/bridge/bridge-init-frame.ts # mobile/src/mobile-web-shell/bridge/bridge-rpc-client.ts # mobile/src/transport/mobile-relay-rpc-session.ts # mobile/src/transport/mobile-relay-rpc-streams.ts # mobile/src/transport/rpc-client-request-tracker.ts # mobile/src/transport/rpc-client-stream-registry.ts # mobile/src/transport/rpc-client.ts # mobile/src/transport/unvalidated-rpc-request-port.ts
The server name now rides the generic request envelope from #27815 instead of its own executionHost option, bridge grant and per-transport plumbing. Server rows show only where the transport carries an envelope (native, or a shell that grants rpcEnvelope), so an older app keeps today's list. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
# Conflicts: # mobile/src/host-screen/host-server-workspaces-wiring.test.ts
A server workspace call still reaches the desktop as the same top-level executionHost frame, on the direct and relay wires, and a deep link into a server workspace under an app without rpcEnvelope shows the unreachable screen. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…rder Equal envelopes name one cleanup slot whatever their key order, the scoped view passes its client's envelope answer through as it does the generation, and the direct wire harness is shared instead of rebuilt. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
# Conflicts: # mobile/src/transport/execution-host-envelope.test.ts
# Conflicts: # mobile/src/components/WorktreeListRow.tsx
…ktop's chat setting A relayed agent.launch ran on the server, which picked chat vs terminal from its own setting. The desktop relay now stamps its own default as nativeChatDefault; new servers use it in place of their setting (feasibility still decides), older servers strip it. Outside the replay fingerprint. Co-Authored-By: Claude <[email protected]>
…ts own module Keeps mobile-desktop-relay.ts under the line limit once #27749's page relay lands on it. Co-Authored-By: Claude <[email protected]>
…chat default The early-tab preflight read the server's own chat setting while the launch used the desktop's stamped nativeChatDefault, so on a windowed server with chats off a relayed chat launch flashed a terminal tab. Both now read the settings through readAgentLaunchModeSettings(runtime, nativeChatDefault).
|
Warning Review limit reachedYou'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 25 minutes. View limit details
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: 🔵 Low · up to
|
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟡 Minor · Auto-selection can pick the wrong host's repo when IDs… · use-new-workspace-repositories.ts:77-90
mobile/src/components/use-new-workspace-repositories.ts:77-90
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winAuto-selection can pick the wrong host's repo when IDs collide.
The preferred repo is found with
repos.find((repo) => repo.id === preferredRepoId). This lookup ignores the host. The combined list puts desktop repos first, so a desktop repo usually wins a collision. SupposegetMobileNewWorkspaceDialogEligibleReposdrops the desktop entry and keeps a server entry with the same ID. The lookup can then return the desktop entry, which is not eligible. SearcheligibleReposinstead, so the resolved ID maps back to an entry that the resolver considered.Proposed fix
- const preferredRepo = repos.find((repo) => repo.id === preferredRepoId) ?? null + const preferredRepo = eligibleRepos.find((repo) => repo.id === preferredRepoId) ?? null
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
7666e7eb-ac8d-4e5b-b338-a36a1062bc9b
📒 Files selected for processing: 28
mobile/src/components/HostKindIcon.tsxmobile/src/components/NewWorktreeFormSheet.tsxmobile/src/components/NewWorktreeModal.test.tsxmobile/src/components/NewWorktreeModal.tsxmobile/src/components/NewWorktreeModalController.tsxmobile/src/components/NewWorktreeModalDrawers.tsxmobile/src/components/NewWorktreeProjectTargetFields.tsxmobile/src/components/WorktreeListRow.tsxmobile/src/components/new-workspace-project-targets.test.tsmobile/src/components/new-workspace-project-targets.tsmobile/src/components/new-worktree-modal-types.tsmobile/src/components/use-new-workspace-repositories.tsmobile/src/host-screen/host-screen-operations.tsmobile/src/host-screen/host-screen-overlays.test.tsxmobile/src/host-screen/host-screen-overlays.tsxmobile/src/host-screen/host-server-workspaces-wiring.test.tsmobile/src/host-screen/host-ssh-health-badge-wiring.test.tsmobile/src/host-screen/use-host-display-worktrees.tsmobile/src/host-screen/use-host-screen-controller.tsmobile/src/host-screen/use-host-worktree-actions.tsmobile/src/transport/execution-host-envelope.test.tsmobile/src/transport/execution-host-scoped-rpc-client.tsmobile/src/transport/unvalidated-rpc-request-port-inventory.tsmobile/src/worktree/new-workspace-dialog-repo-selection.test.tsmobile/src/worktree/new-workspace-dialog-repo-selection.tsmobile/src/worktree/server-workspaces.test.tsmobile/src/worktree/server-workspaces.tstests/e2e/paired-mobile-desktop-mirror.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.
ELI5
From the phone, you can now create a new workspace on one of the desktop's Orca servers, the same way the
desktop does. The "Run on" picker names each host exactly as the desktop's picker does. Creating and
closing tabs on a server already worked; this adds a test proving it.
Stacked on #26501. Review only this branch's own commits.
Stack and merge order.
Phones need the app build that grants
rpcEnvelope(#27815) before server workspaces appear. Untilthen the phone shows today's list, with no server rows.
What Changed
Before: the phone's New Workspace sheet listed only the desktop's repos, so you couldn't create a
workspace on a server from the phone. A server row's long-press menu offered Sleep, which would have put
the desktop's workspace of the same id to sleep, not the server's.
After:
server's repos (
repo.listthrough that server) as it answers, so a hung server doesn't block the list.itself. So it offers and names the servers even when opened from Home, before the workspace list has
loaded.
the desktop through the routing table.
"Remote ·" or "SSH ·" prefix, from the same label function as the desktop's picker and the phone's list
badge. The desktop's own row reads, for example, "Local Mac" when its platform is known, instead of
"This computer".
workspaces are deliberately not in this PR (see Why).
and show on the desktop; the e2e now proves it.
instead of a raw send, which retires a port-inventory entry. Behaviour is unchanged.
Why
Creating a workspace is a server job, so it runs on the server through the relay like every other workspace
call. Showing the desktop's repos first keeps the sheet as fast as today. The sheet reads the server list
itself because the workspace list deliberately pauses its refresh while the sheet is open, so its rows
can't be relied on there.
Server sleep and wake would go through desktop-window requests that the workspace-layout refactor removes.
They'll come back with that refactor as server-side
layout.sleep/layout.wake, so this PR hides Sleepon server rows rather than building a path that is about to be deleted.
Linked Issue
N/A (maintainer)
Visual Proof
N/A. The only visible changes are server repos in the existing "Run on" list, the label change above, and
Sleep missing from a server row's menu. There is no new screen or text. Verified on an Android emulator
against a real desktop and server.
Testing
Automated tests added/updated, or explained why not below
Unit tests:
worktree.sleepand marks the row slept.e2e (
paired-mobile-desktop-mirror.spec.ts), with a real desktop, server and phone: a phone tab createand close shows on the server and the desktop, and a workspace created on the server appears in the
desktop's server list.
Notes