Skip to content

Machines: phone list with Wake and Sleep for the paired desktop - #30708

Open
nwparker wants to merge 8 commits into
nwparker/machines-p0-2b-progressfrom
nwparker/machines-p0-6-mobile
Open

nwparker wants to merge 8 commits into
nwparker/machines-p0-2b-progressfrom
nwparker/machines-p0-6-mobile

Conversation

@nwparker

@nwparker nwparker commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​658 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​658
Prod 14 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​832 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​832

ELI5

You can now see your machines from your phone, and wake or sleep them there. A paired phone gets a Machines page for the desktop it's paired with. The page lists every machine the desktop's machine plugins manage, shows whether each one is running, sleeping or gone, and has a Wake or Sleep button. Creating, archiving and deleting machines still happens only on the desktop.

What Changed

Before: the desktop could list, wake and sleep machines over runtime RPC, but a phone could not reach those calls, and the mobile app had no place to show machines.

After:

  • Header button. The host screen gets a Machines button, in both the phone header and the wide-layout toolbar. It only appears once the desktop has answered machines.list with at least one provider. An older desktop, a desktop with Machines turned off, or a headless server with no providers never shows it. The check resets when the connection drops and runs again when the app returns to the foreground, so turning Machines on or off on the desktop shows up.
  • Machines page (/h/<host>/machines). Each provider is a section, and each machine row shows:
    • name and state (Running, Sleeping, Starting, Waking, Unreachable, Gone);
    • Persistent or Temporary, plus when a temporary machine is deleted. The time is read on the provider's clock and includes the date when it is more than a day away;
    • the provider's one-line detail.
  • Actions. Running machines offer Sleep, which asks for confirmation because it stops terminals and agents on the machine. Sleeping or archived machines offer Wake.
    • When the provider refuses, a dialog shows its message.
    • When the phone loses contact mid-action (a wake can take minutes), it says "Lost contact; checking what happened…" and re-lists rather than reporting a refusal, because the action may still be running on the desktop.
  • Refresh. Opening the page, returning to the app, and the Refresh button ask the providers (through the desktop's 30-second cache). The 60-second poll only re-reads the desktop's cached list, so an open page never keeps running billed provider calls.
  • Staleness. If a refresh fails, the phone keeps the rows it has, dims them, and says how old they are.

Mechanism:

  • Server routing. machines.list|get|wake|sleep are added to the methods the paired desktop answers itself (PAIRED_DESKTOP_METHODS), because the machine providers are plugins installed and run on that desktop.
  • Authorization. The dispatcher already checks every phone call against the mobile allowlist, so a phone reaches exactly read, wake and sleep. Create, archive and delete are not runtime RPC methods at all. Wake and sleep are logged with the phone's device id.
  • Mobile module (mobile/src/machines/).
    • The calls are typed RPC operations, not raw requests, and every request is caught, so nothing rejects unhandled or sticks on Loading.
    • The reply readers treat method_not_found or forbidden (an older desktop) and unsupported (Machines off) as unavailable. They drop a single unreadable machine row rather than failing the whole list.
    • The row model and expiry maths reuse the shared machineMsUntilExpiry. A lifetime value the app doesn't know shows nothing, and expiries more than a day away name the date (and the year when it isn't this year).
    • Machines use the same Box glyph as on the desktop.
  • Logging. Wake and sleep are logged with a short hash of the phone's device id, not the id itself.
  • Screen and routes. The screen uses the Accounts screen's frame. The route is registered with the host stack, the page-route table (same grants as Accounts) and the route-module census.

Why

  • Answered by the paired desktop rather than the server a call names. The desktop is where the provider plugins, their consent and the user's credentials live. A server without providers answers "unsupported", which the app treats as hidden.
  • The button only appears after a real answer, instead of on a capability flag. A capability says the desktop's build knows about machines. It cannot say Machines is turned on and that there is at least one provider, and a button that leads to an empty or refused page is worse than no button.
  • Read, wake and sleep only. A paired phone can already run commands on the host, so waking or sleeping a machine through the host's already-approved provider gives it no new power. Spending money (create) or destroying data (archive, delete) stays on the desktop for now.

Linked Issue

Fixes #

Visual Proof

The Machines page as rendered in a browser by the new render test (390×844), with one running, one sleeping (Temporary, with a deletion date) and one gone machine:

mobile-machines.png

Testing

  • Hook tests (mobile, use-host-machines.test.tsx):

    • Opening asks providers, and the 60-second poll doesn't.
    • A failed refresh keeps the rows, marked stale with their read time.
    • A transport failure during wake is reported as "Lost contact" and triggers a re-list, and a provider refusal is shown as one.
    • The header check resets on disconnect and runs again on foreground.
  • Unit tests (mobile):

    • Reply readers: providers come through; method_not_found and unsupported read as unavailable; other failures carry the provider message.
    • Row model: Wake/Sleep choice, labels and colours, expiry on the provider clock (including a provider whose clock runs ahead).
    • Header: the Machines button is hidden without providers and opens /h/<host>/machines with providers.
  • Browser render test (config/scripts/mobile-web-app-machines-render.test.mjs). It builds the mobile web bundle and opens the page in headless Chromium against the shell double, which answers machines.list and machines.wake. It checks the rows and states, that tapping Wake sends { providerKey, machineId }, and that the page logs no errors.

  • Runtime:

    • The routing test pins the four methods to the paired desktop and that create, archive and delete don't exist for phones.
    • A dispatcher test calls machines.wake as a mobile-scoped caller. It is admitted and logged with a hashed device id that doesn't contain the raw id, and machines.create is refused.
    • The mobile allowlist scan passes.
  • Mobile suite: typecheck, lint, format check, the tests-typecheck ratchet and the full suite (1,057 files) pass.

  • Census tests: the page-route, grant, haptics and external-link census tests pass.

  • Platforms:

    • The page is checked in Chromium through React Native Web, which is the page the native shell loads from the desktop.
    • Not run on a physical iOS or Android device.
  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

AI Disclosure

Review

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

  • Mixed versions:
    • A desktop without this change serves a page bundle with neither the page nor the button.
    • An older native app reaches the page through the existing catch-all host route.
    • An older desktop answers forbidden or method_not_found, which hides the button.
  • No new stream opcodes. Progress events stay on the desktop; phones follow state through list and get.
  • Security: only read, wake and sleep are reachable, calls go through the existing mobile scope check, and wake and sleep are logged with a hashed device id.

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)

@nwparker
nwparker force-pushed the nwparker/machines-p0-6-mobile branch 6 times, most recently from 2e92cf6 to fe67f1c Compare October 19, 2026 15:58
This was referenced Oct 20, 2026
machines.list/get/wake/sleep join the methods the paired desktop answers
itself, since providers are plugins it runs. Create, archive and delete
are not runtime RPC methods, so they stay off the phone.
The host screen shows a Machines button once the desktop answers
machines.list with at least one provider; an older desktop, Machines off,
or a server with no providers hides it. The page lists each provider's
machines with state, lifetime, expiry on the provider's clock and
detail, offers Wake on sleeping or archived machines and Sleep on running
ones, and refreshes on focus and every minute while foregrounded. Create,
archive and delete stay on the desktop.
…ouble

Builds the mobile web bundle, opens /h/<host>/machines with replies for
machines.list and machines.wake, checks the rows and states, and that
Wake sends the machine's selector. ORCA_MOBILE_WEB_MACHINES_SCREENSHOT
saves the rendered page.
… device

Dispatches machines.wake as a mobile-scoped caller: it is admitted, the
wake is logged with the phone's device id, and a machine verb outside
read, wake and sleep is refused.
- Polls re-read the desktop's cached list; only opening the page,
  returning to the app and a manual refresh ask providers (which can be
  billed cloud calls).
- A wake or sleep that loses the connection says "Lost contact; checking
  what happened" and re-lists, instead of reporting a refusal; every
  request is caught, so nothing rejects unhandled or sticks on Loading.
- A failed refresh keeps the rows, dimmed, with how old they are.
- Sleep asks for confirmation; machines use the Box glyph.
- The header's Machines check resets on disconnect and re-runs when the
  app returns, so turning Machines on or off shows up.
- One unreadable machine row is dropped, not the whole list; unknown
  lifetimes show nothing; far expiries name the year.
- Toolbar button hit area and the busy spinner's spoken label.
- Wake and sleep logs carry a short hash of the device id, not the id.
- Polls re-read the desktop's cached list; only opening the page,
  returning to the app and a manual refresh ask providers (which can be
  billed cloud calls).
- A wake or sleep that loses the connection says "Lost contact; checking
  what happened" and re-lists, instead of reporting a refusal; every
  request is caught, so nothing rejects unhandled or sticks on Loading.
- A failed refresh keeps the rows, dimmed, with how old they are.
- Sleep asks for confirmation; machines use the Box glyph.
- The header's Machines check resets on disconnect and re-runs when the
  app returns, so turning Machines on or off shows up.
- One unreadable machine row is dropped, not the whole list; unknown
  lifetimes show nothing; far expiries name the year.
- Toolbar button hit area and the busy spinner's spoken label.
- Wake and sleep logs carry a short hash of the device id, not the id.
Providers may now report `stopping` for a sleep or archive they accepted
but have not finished; the row shows it busy instead of Unknown.
The row model uses shared/machine-display, so the phone shows the
desktop's words (Starting, Sleeping…, Error, Unreachable), and a state
from a newer desktop reads Unreachable, not blank. Wake and Sleep are
offered only if the provider declares those verbs. A desktop that sends
no capabilities still gets both, as before.
@nwparker
nwparker force-pushed the nwparker/machines-p0-2b-progress branch from eec0f9c to f204f6d Compare October 21, 2026 19:01
@nwparker
nwparker force-pushed the nwparker/machines-p0-6-mobile branch from 4f378cb to 439ec25 Compare October 21, 2026 19:01
@nwparker
nwparker marked this pull request as ready for review October 21, 2026 19:02

This branch has not been deployed

No deployments
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