Repository navigation
feat: view your machine's screen from the iOS and Android apps - #123097
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
d64b358 to
e7fa7cf
Compare
|
Codex review: needs changes before merge. Reviewed August 13, 2026, 6:14 AM ET / 10:14 UTC. ClawSweeper reviewWhat this changesAdds a shell-free Control UI desktop document with touch controls and iOS/Android entry points for viewing a Gateway or node desktop. Merge readinessKeep open: the new native availability checks omit the existing operator.admin requirement, so limited-scope mobile connections can see Desktop only to have the Gateway reject it. The mobile document-mode design otherwise fits the companion-app direction. Priority: P2 Review scores
Verification
How this fits togetherThe native apps load an authenticated, Gateway-served Control UI document in a WebView. That document requests desktop sources and a short-lived RFB stream from the Gateway, which remains the authorization and relay owner. flowchart LR
A[Mobile app] --> B[Authenticated Control UI]
B --> C[Desktop availability check]
C --> D[Gateway desktop observer]
D --> E[Authorization and source selection]
E --> F[Remote desktop stream]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +603, Tests +312, Other +611. Total +1526 across 34 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Gate both native entry points on a connected operator.admin session as well as desktop.observe, with focused limited-scope visibility coverage, while keeping Gateway-side authorization authoritative. Do we have a high-confidence way to reproduce the issue? Yes, from source: connect either native app with operator.read but not operator.admin to a Gateway advertising desktop.observe; the new entry appears, while the Gateway contract rejects desktop.observe. Is this the best way to solve the issue? No: reusing the Control UI document is appropriate, but its native availability checks must match the existing operator.admin-plus-method gate before this is the best solution. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 2278ca6952ea. LabelsLabel changes:
Label justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
Add a shell-free mobile desktop route that reuses the dock panel controller and lazy noVNC client, with source preselection, touch controls, keyboard input, and retryable inventory failures.
The per-session viewer replaces SessionDashboardScreen in place instead of pushing a shell tab, so System Back fell through to the shell-level handler and popped the whole Dashboard tab, stranding the operator on Chat. Claim Back while the viewer is showing. Also carry over TerminalSettingsScreen's imePadding: the viewer's own touch toolbar hosts the keyboard affordance, so the soft keyboard would cover it. Proof (emulator, Medium_Phone_API_36.0, stub control UI on 18789): pre-fix Back from the viewer lands on Chat; post-fix it returns to Dashboard. No Robolectric regression test — no existing screen test constructs MainViewModel, and BackHandler under Robolectric would need new scaffolding for weaker evidence than the live repro.
…ment `ui/vitest.config.ts` runs the unit project with `isolate: false`, so test files share one jsdom document inside a worker. `view.pairing.test.ts` appends a container to `document.body` for every case and never tears down, unlike its sibling `channels-page.test.ts`, so whichever suite the worker scheduled next inherited a mounted pairing dialog. That surfaced on this PR's first CI run as ten failures in the untouched `input-dialog.test.ts`, which found "Approve DM access" where it expected "Rename session". A rerun went green, so the ordering is scheduler-dependent rather than deterministic; this removes the contamination source rather than leaving the next suite to lose the race. Not a proven fix for that specific run — the leak reproduces only under CI's file scheduling, and the full suite passes locally either way — but the missing teardown is a real violation of the shared-environment contract.
14033a0 to
f036030
Compare
The rail e2e captured the main transcript's text before opening a task detail and required it to be byte-identical afterwards. A running task renders a live elapsed label, so the assertion failed whenever a second ticked over between the two reads — twice while landing this PR, both times "12s" against "13s" with no other difference. Normalize elapsed labels on both sides instead of weakening the assertion. The invariant it protects, that opening a detail leaves the main transcript alone, still holds: a real content change is still caught, and only complete duration tokens collapse, so diffstat figures like +14/-3 and phrases like "5 messages" are untouched.
|
Merged via squash.
|
…law#123097) * feat(ui): add mobile desktop document mode Add a shell-free mobile desktop route that reuses the dock panel controller and lazy noVNC client, with source preselection, touch controls, keyboard input, and retryable inventory failures. * feat(ios): add desktop viewer entry points * feat(android): add desktop viewer * fix(android): keep System Back inside the desktop viewer The per-session viewer replaces SessionDashboardScreen in place instead of pushing a shell tab, so System Back fell through to the shell-level handler and popped the whole Dashboard tab, stranding the operator on Chat. Claim Back while the viewer is showing. Also carry over TerminalSettingsScreen's imePadding: the viewer's own touch toolbar hosts the keyboard affordance, so the soft keyboard would cover it. Proof (emulator, Medium_Phone_API_36.0, stub control UI on 18789): pre-fix Back from the viewer lands on Chat; post-fix it returns to Dashboard. No Robolectric regression test — no existing screen test constructs MainViewModel, and BackHandler under Robolectric would need new scaffolding for weaker evidence than the live repro. * test(ui): stop the pairing views leaking dialogs into the shared document `ui/vitest.config.ts` runs the unit project with `isolate: false`, so test files share one jsdom document inside a worker. `view.pairing.test.ts` appends a container to `document.body` for every case and never tears down, unlike its sibling `channels-page.test.ts`, so whichever suite the worker scheduled next inherited a mounted pairing dialog. That surfaced on this PR's first CI run as ten failures in the untouched `input-dialog.test.ts`, which found "Approve DM access" where it expected "Rename session". A rerun went green, so the ordering is scheduler-dependent rather than deterministic; this removes the contamination source rather than leaving the next suite to lose the race. Not a proven fix for that specific run — the leak reproduces only under CI's file scheduling, and the full suite passes locally either way — but the missing teardown is a real violation of the shared-environment contract. * test(ui): stop the background-tasks rail asserting on a ticking clock The rail e2e captured the main transcript's text before opening a task detail and required it to be byte-identical afterwards. A running task renders a live elapsed label, so the assertion failed whenever a second ticked over between the two reads — twice while landing this PR, both times "12s" against "13s" with no other difference. Normalize elapsed labels on both sides instead of weakening the assertion. The invariant it protects, that opening a detail leaves the main transcript alone, still holds: a real content change is still caught, and only complete duration tokens collapse, so diffstat figures like +14/-3 and phrases like "5 messages" are untouched.
What Problem This Solves
Operators could already watch a machine's screen from the Control UI in a desktop browser, but not
from their phone. The desktop surface was a dock panel with a 380px minimum width, bottom/right
docking, and no touch affordances — desktop chrome that does not fit a 390pt phone — and neither
the iOS nor the Android app had any entry point to it at all. If you were away from your desk and
wanted to see what your gateway host or one of your nodes was actually doing, there was no way to
do it.
Why This Change Was Made
This adds a desktop-only document mode to the Control UI (
/?view=desktop, or/desktop), mirroringthe existing terminal document mode, and gives the iOS and Android apps entry points that load it in
their existing authenticated Control UI webview. The route renders full-bleed with no app shell and a
compact four-action touch toolbar (view-only/control, keyboard, fit, back); noVNC's built-in
GestureHandleralready provides two-finger scroll, long-press right-click and pinch, so no gesturesare reimplemented. View-only is the default and control is an explicit toggle.
This is a client and presentation change only. The gateway side already ships
desktop.observewithhost/environment/node sources, the RFB relay, and protocol-level view-only enforcement; none of that
is touched. Credentials never enter a URL — the native apps inject them with their existing
document-start script, and VNC passwords stay in memory.
Each app places the standalone entry where that platform already keeps Terminal: a sidebar Page on
iOS, and Settings → Agents & automation on Android, whose sidebar is a curated five-item set that
does not include Terminal either. Both also add a per-session action. Both entry points are hidden
unless the gateway advertises
desktop.observe.User Impact
You can now open your machine's screen from your phone. On iOS it is a Desktop page in the sidebar
plus a toolbar button on a session; on Android it is Settings → Agents & automation → Desktop plus a
session action. Both open a full-screen viewer that starts view-only, with a touch toolbar for taking
control, raising the keyboard, and toggling fit-to-screen. Gateway hosts, cloud environments, and
paired nodes all appear in the viewer's source picker.
Two blank-screen defects found while testing this on a real device are fixed as part of it. One of
them also fixes the already-shipped
?view=terminaldocument mode, which could be redirected intomodel setup on a gateway with no provider configured.
Evidence
End-to-end on a real desktop, not a mock. A TigerVNC + XFCE container (
RFB 003.008, VncAuth)behind a gateway on an isolated loopback port, viewed through the Android app's Desktop screen: the
source picker lists the machine, connecting streams live XFCE pixels, and the VNC server log
independently records
SConnection: Client requests security type VncAuth(2)with negotiated pixelformats. The same flow verified in a 375x812 browser viewport, where the toolbar reports
aria-pressed="false"on "Take control" (view-only default) and flips to "Switch to view only" whentoggled.
Two defects found live and fixed at the root.
Android WebView collapses viewport height units. The viewer sized itself with
height: 100dvhandrendered as a blank page. Measured in the WebView:
dvh,vh,svhandlvhall resolve to0while
100%andinnerHeightcorrectly report708. The fixed inset already sizes the element, sothe height is removed with a comment so it does not come back.
The first-run model-setup redirect hijacked document modes. A
?view=document mode still lands onthe chat path, so
isDefaultChatLandingmatched it and a gateway without a configured providerredirected the viewer into model setup. Only the redirect is gated —
firstRunDefaultLandingkeepsits previous value because it also drives
deferInitialLocationUntilGateway. Verified against theshipped terminal mode, which reproduced the same redirect before the fix.
Android System Back left the session. The per-session viewer replaces the dashboard in place rather
than pushing a nav destination, so Back fell through to the shell handler and popped the whole tab.
Reproduced on the emulator against a pre-fix build — Back landed on Chat, skipping the dashboard —
and returns to the dashboard with the fix.
Gates. Full UI suite green (8673 unit tests), both e2e suites including main's expanded
desktop-panel.e2e.test.tsfrom #122992,pnpm ui:i18n:verify, knip dead-export scan at 0 entries,oxfmt,
git diff --check, andpnpm ui:build— startup JS stayed within budget, confirming theviewer remains lazily loaded. Android
assemblePlayDebug, unit tests, ktlint, and lint pass; iOSbuilds for the simulator with its unit tests green.
Known follow-ups, not addressed here. The Control UI webview renders in light theme while the
native app is dark — a pre-existing theme-sync gap that affects the Terminal screen identically.
TigerVNC's default blacklist threshold can trip on probe-plus-attach arriving from one NAT'd source
address, which is worth watching for real Linux hosts.
Android: before and after the WebView sizing fix
Same build, same gateway, same Desktop screen. Before, every viewport height unit resolved to 0 and
the viewer collapsed to a blank page; after, the picker connects and streams the real XFCE desktop
with the touch toolbar overlaid.
Re-verification note
The Control UI reconciliation onto current
main(which landed #122992 refactoring the same panel)was re-verified in a browser at phone viewport and, more directly, by driving the Android app's own
authenticated WebView — it returns the source picker with the host machine listed. The native
Android Settings row was verified end-to-end before the reconciliation; after it, repeated test
gateway restarts left the emulator unpaired, so that specific surface was not re-demonstrated
against the reconciled build. Nothing in the reconciliation touches
apps/android.