You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(mobile): sleep a server workspace from the phone's row menu - #44206
On the phone, the workspace menu had no Sleep for workspaces that live on a paired Orca server. Now it does, and Sleep is greyed out when there is nothing to sleep, the way the desktop menu does it.
Files
Added
Deleted
Net
Test
0
0
0
0
Prod
4
$\color{#1a7f37}{\Huge{\mathbf{+}}}$44
$\color{#cf222e}{\Huge{\mathbf{−}}}$22
$\color{#1a7f37}{\Huge{\mathbf{+}}}$22
What Changed
Before: a server workspace's row menu on the phone showed Source Control, Rename, Pin and Delete, with no Sleep. On every other row Sleep was always enabled, even with nothing running, and if the host refused the sleep the row still looked asleep until the next refresh.
After: server rows get Sleep too. Sleep is greyed out when the host reports nothing to sleep (hasHostSidebarActivity === false), or when the row's server isn't connected. A refused sleep puts the row back the way it was.
Mechanism:putWorktreeToSleep now sends worktree.sleep through the row's own client (clientForRow, the same rpcClientForExecutionHost route pin, rename and delete already use). worktree.sleep is already an execution-host route in runtime-rpc-mobile-method-routing.ts, so the desktop forwards it to the server. The phone's "asleep until the host confirms" ids are now checked against the list that owns each row: desktop rows against the desktop catalog, server rows against the server-rows read, on every reply. Before, any desktop catalog update dropped a server row's id.
Why
The phone used to send the sleep to the desktop with no executionHost. For a server row's id the desktop refuses it (selector_not_found; checked live, see Testing), which is why the menu hid Sleep on server rows. Routing to the row's owner is the path the phone's other row actions already take, so no host change is needed.
Not in this PR, both from review and both bigger than this fix:
Sleeping a server row from the desktop runs the desktop's own sleep, which also closes that workspace's browser tabs on the desktop and suspends a recipe VM the desktop owns. The phone's sleep goes straight to the server, so it stops the server's terminals and chats but leaves the desktop's browser tabs and a desktop-owned VM running. Matching that means the desktop running a host-qualified sleep for a phone request, which needs a new route and a capability gate.
Desktop's "Sleep with N descendants" item.
Linked Issue
Surface parity gap WS-L9 (no GitHub issue).
Visual Proof
The phone row menu for a server workspace, rendered from the phone's ActionSheetContent in Chromium at phone width:
Before (server row)
After (server row with running work)
After (server row with nothing running)
Testing
Ran the real three-process topology (launchPhoneMirrorTopology: headless orca serve, a hidden desktop paired to it, and a phone socket paired to the desktop) in a throwaway spec, with one terminal in a server workspace:
server row before: liveTerminalCount 1, hasHostSidebarActivity true
worktree.sleep with no executionHost (what the phone sent): selector_not_found, row unchanged
worktree.sleep with the server's executionHost (what the phone sends now): ok; the row then reads liveTerminalCount 0, hasHostSidebarActivity false, so the phone greys Sleep out
a missing workspace: ok: false, which the phone now reverts on
mobile typecheck, focused mobile Vitest (src/test-support/rpc-recording, src/host-screen, src/worktree/row-presentation), pnpm check:changed.
No test added: the route already has coverage on the host side, and the phone change is a client choice inside a hook. The live topology run above is the check.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
Risk
The riskiest part is the new route for server rows. If it goes wrong, the user taps Sleep on a server row, the row looks asleep for a moment, and then it comes back. Desktop and SSH rows still go to the desktop client as before. Mixed versions:
A desktop that can't relay to servers: clientForRow returns null and Sleep is greyed out.
A host that doesn't send hasHostSidebarActivity: Sleep stays enabled, as it is today.
Back out with a plain revert.
Level: Low
AI Disclosure
Review
Two review rounds (Codex and Claude). Round 1 fixes are in this PR: grey Sleep out when the server isn't connected, and check the asleep ids on every server reply. Round 2 raised no P0 or P1. The desktop browser-tab and VM gaps it raised are listed under Why.
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
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Phone-only change. It adds no new RPC and uses the existing execution-host relay. SSH rows keep going through the desktop.
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)
I stated the risk: what could break, for whom, and how to back it out
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)
Review was skipped as selected files did not have any reviewable changes.
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: 0a8fa650-4c10-420a-af89-67098fd2928f
Commits
Reviewing files that changed from the base of the PR and between 1653e44 and 829254c.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
Walkthrough
The Sleep action is available subject to sidebar activity and server connection checks. Sleep requests use the row’s execution-host client and optimistically mark the row as asleep; refused or failed requests remove that mark. Catalog confirmation retains identities outside the current list’s row domain and matching identities with live terminals. Server-row confirmation also runs when the server data update timestamp changes.
Merge Risk: Low · previous review 1653e
Sleep from the phone's row menu works, and a refused request reverts the row. In a rare race, where another client wakes the workspace before the phone sees it as asleep, the row can keep showing as inactive. This is minor and can be followed up on.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: Sleep is added to the phone's row menu for server workspaces. It follows the fix(mobile) convention and matches the diff summary (sleep routed through the row's execut…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Description check
The description follows the repository template closely: it has ELI5, What Changed (before/after with mechanism), Why (with alternatives and out-of-scope items), Linked Issue, Visual Proof with before…
Full details: Title check
Explanation
The title names the main change: Sleep is added to the phone's row menu for server workspaces. It follows the fix(mobile) convention and matches the diff summary (sleep routed through the row's execution-host client, and the Sleep action now shown for server rows). It is specific and short.
Full details: Description check
Explanation
The description follows the repository template closely: it has ELI5, What Changed (before/after with mechanism), Why (with alternatives and out-of-scope items), Linked Issue, Visual Proof with before/after images, Testing with a concrete three-process topology run, a Risk section with level and back-out plan, and a completed checklist. Minor gaps: the Linked Issue names a surface parity item (WS-L9) rather than a GitHub issue, the Risk level is stated as Low without the template's 'Fixes #' link, the AI Disclosure section is empty, the 'Review' section is filled in, and the final lint/typecheck/test/build checklist item is unchecked. None of these are critical, so the description is mostly complete.
Finishing Touches
Fix failing CI checks
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.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
The phone sent worktree.sleep to the paired desktop without the row's
executionHost, so the desktop refused a server workspace's id and the
menu hid Sleep on server rows. Route it through the row's client like
pin and rename, grey Sleep out when the host reports nothing to sleep
(as desktop does), and undo the asleep look when the host refuses.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
On the phone, the workspace menu had no Sleep for workspaces that live on a paired Orca server. Now it does, and Sleep is greyed out when there is nothing to sleep, the way the desktop menu does it.
What Changed
hasHostSidebarActivity === false), or when the row's server isn't connected. A refused sleep puts the row back the way it was.putWorktreeToSleepnow sendsworktree.sleepthrough the row's own client (clientForRow, the samerpcClientForExecutionHostroute pin, rename and delete already use).worktree.sleepis already an execution-host route inruntime-rpc-mobile-method-routing.ts, so the desktop forwards it to the server. The phone's "asleep until the host confirms" ids are now checked against the list that owns each row: desktop rows against the desktop catalog, server rows against the server-rows read, on every reply. Before, any desktop catalog update dropped a server row's id.Why
The phone used to send the sleep to the desktop with no
executionHost. For a server row's id the desktop refuses it (selector_not_found; checked live, see Testing), which is why the menu hid Sleep on server rows. Routing to the row's owner is the path the phone's other row actions already take, so no host change is needed.Not in this PR, both from review and both bigger than this fix:
Linked Issue
Surface parity gap WS-L9 (no GitHub issue).
Visual Proof
The phone row menu for a server workspace, rendered from the phone's
ActionSheetContentin Chromium at phone width:Testing
Ran the real three-process topology (
launchPhoneMirrorTopology: headlessorca serve, a hidden desktop paired to it, and a phone socket paired to the desktop) in a throwaway spec, with one terminal in a server workspace:liveTerminalCount 1,hasHostSidebarActivity trueworktree.sleepwith noexecutionHost(what the phone sent):selector_not_found, row unchangedworktree.sleepwith the server'sexecutionHost(what the phone sends now):ok; the row then readsliveTerminalCount 0,hasHostSidebarActivity false, so the phone greys Sleep outok: false, which the phone now reverts onmobiletypecheck, focused mobile Vitest (src/test-support/rpc-recording,src/host-screen,src/worktree/row-presentation),pnpm check:changed.No test added: the route already has coverage on the host side, and the phone change is a client choice inside a hook. The live topology run above is the check.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
Risk
The riskiest part is the new route for server rows. If it goes wrong, the user taps Sleep on a server row, the row looks asleep for a moment, and then it comes back. Desktop and SSH rows still go to the desktop client as before. Mixed versions:
clientForRowreturns null and Sleep is greyed out.hasHostSidebarActivity: Sleep stays enabled, as it is today.Back out with a plain revert.
Level: Low
AI Disclosure
Review
Two review rounds (Codex and Claude). Round 1 fixes are in this PR: grey Sleep out when the server isn't connected, and check the asleep ids on every server reply. Round 2 raised no P0 or P1. The desktop browser-tab and VM gaps it raised are listed under Why.
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Phone-only change. It adds no new RPC and uses the existing execution-host relay. SSH rows keep going through the desktop.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)