Skip to content

fix(mobile): sleep a server workspace from the phone's row menu - #44206

Merged
AmoabaKelvin merged 2 commits into
mainfrom
fix/phone-sleep-server-rows
Nov 18, 2026
Merged

AmoabaKelvin merged 2 commits into
mainfrom
fix/phone-sleep-server-rows

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

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.

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)
menu-dark-before.png menu-dark-after.png menu-dark-idle.png

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)

@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

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: Passed 4

Check name Status Explanation
Title check Passed 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 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.
Description check Passed 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.

Share

@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: 1

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: eaa7b41c-92b8-4246-abb7-910fc4da968f
Commits

Reviewing files that changed from the base of the PR and between 270fc64 and 1653e44.

Files selected for processing: 4

  • mobile/src/host-screen/catalog/use-host-worktree-catalog.ts
  • mobile/src/host-screen/host-screen-overlays.tsx
  • mobile/src/host-screen/workspace-actions/use-host-worktree-actions.ts
  • mobile/src/worktree/row-presentation/worktree-host-row-identity.ts

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.
@AmoabaKelvin
AmoabaKelvin force-pushed the fix/phone-sleep-server-rows branch from 1653e44 to 829254c Compare November 18, 2026 19:52
@AmoabaKelvin
AmoabaKelvin merged commit 417eb16 into main Nov 18, 2026
25 checks passed
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