Skip to content

feat(web): mobile pairing over LAN/Tailscale from the web UI - #2

Open
espetro wants to merge 6 commits into
mainfrom
feat/web-mobile-pairing-serve
Open

espetro wants to merge 6 commits into
mainfrom
feat/web-mobile-pairing-serve

Conversation

@espetro

@espetro espetro commented Sep 6, 2026 •

Copy link
Copy Markdown
Owner
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​161 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​161
Prod 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​217 $\color{#cf222e}{\Huge{\mathbf{−}}}$​17 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​200

Problem

In the orca-serve web UI, the "orca mobile" connect step could not list network interfaces (no Tailscale option) and QR minting failed with "WebSocket transport is not running".

Root cause: web-mobile-api.ts hard-stubbed listNetworkInterfaces -> [] and getPairingQR -> { available: false } after the upstream preload refactor (stablyai#16181). The pairing machinery itself is pure Node and already runs in the headless orcad process; it was unwired for web, not blocked.

Changes

Server (feat(rpc))

  • New RPC methods on the existing JSON-RPC WebSocket channel, registered through PAIRING_METHODS:
    • pairing.mintOffer — wraps createMobilePairingOffer (same logic as desktop mobile:getPairingQR), encodes the QR server-side, fails closed with guidance when local-only reach has no advertisable address
    • pairing.listNetworkInterfaces — pure node:os enumeration, Tailscale (100.x) addresses ranked first
    • pairing.getRuntimePairingUrl — mirrors desktop mobile:getRuntimePairingUrl, including the network-exposure widen and its failure guidance
  • PairingRpcContext gained optional minting delegates; the WebSocket dispatch wires them off the authenticated runtime server. Phones cannot call the new methods: they are not in MOBILE_RPC_METHOD_ALLOWLIST, so only authenticated runtime-scope (web/desktop) clients can.

Web client (feat(web))

  • web-mobile-api.ts un-stubs listNetworkInterfaces / getPairingQR / getRuntimePairingUrl by routing over callRuntimeResult (pattern from web-runtime-calls.ts). Interface listing soft-fails to an empty list.
  • Device management (listDevices / revokeDevice / runtime access grants) and Windows-only firewall APIs remain stubbed — they need a registry-backed RPC namespace and are out of scope here.

Byte-compatible QR

The minted QR carries the same endpoint + device token + host pubkey payload as the desktop flow (LAN/tailnet direct endpoints included), so the existing phone app pairs with no changes. No new transport, no REST, no WebRTC.

Testing

  • pairing.test.ts: 6 cases (direct-only QR with advertised tailnet address, unavailable pass-through with reason/guidance, invalid-argument rejection, interface listing)
  • web-mobile-api.test.ts: routing assertions against mocked callRuntimeResult incl. soft-fail behavior
  • pnpm tc:node, pnpm tc:web, changed-code quality gate all clean

Follow-ups (not in this PR)

  • Device registry RPC namespace for web-side device management
  • End-to-end phone scan validation against a running orca-serve

Expose mobile pairing offer minting and network interface enumeration
over the JSON-RPC WebSocket channel so authenticated web clients can do
what the Electron IPC handlers (mobile:getPairingQR etc.) already do.
The new delegates reuse the server-side createMobilePairingOffer /
createPairingOffer logic, so a web-minted QR is byte-compatible with the
existing phone pairing flow (LAN/Tailscale direct endpoints included).
Replace the listNetworkInterfaces / getPairingQR / getRuntimePairingUrl
stubs with routing over the pairing.* RPC methods so the web UI can list
LAN/Tailscale addresses and mint scannable QRs. Device management and
Windows-only stubs stay in place: registry RPC is out of scope.
espetro pushed a commit that referenced this pull request Nov 30, 2026
…e share a name (stablyai#52701)

Check runs were keyed by suite and name, so two same-named runs in one
suite shared one saved row. Every poll one of them carried a different run
id than the saved row and read as a rerun, posting a new "CI green" line
for the same head. Sort observed runs by run id and suffix repeated names
(#2, #3) so each run keeps its own row and an unchanged read compares equal.

Fixes stablyai#52700

Co-authored-by: Neil <[email protected]>
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