Skip to content

feat(runtime): let a paired desktop register its phones as phone devices - #26427

Merged
Jinwoo-H merged 7 commits into
mainfrom
feat/runtime-delegated-mobile-devices
Oct 11, 2026
Merged

Jinwoo-H merged 7 commits into
mainfrom
feat/runtime-delegated-mobile-devices

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​354 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​354
Prod 14 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​319 $\color{#cf222e}{\Huge{\mathbf{−}}}$​117 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​202

ELI5

A desktop connected to an Orca server can now register its paired phones on that server as ordinary
phones. Nothing uses this yet. It's the one server change needed so a phone can later reach the
desktop's remote server workspaces through the desktop, with the server treating each phone exactly
like a phone that paired with it directly.

What Changed

Before: a server only knew the devices that paired with it directly. A desktop relaying a phone's
requests could only send them as itself, so two phones looked like one client and lost phone-specific
handling: terminal seats, clipboard ownership, chat size limits, cleanup.

After:

  • One new runtime-scope request, pairing.delegatedMobileDevice.sync.
    • Params: { phones: [{ phoneKey, name }] }, at most 32 phones, with keys and names of 1–128 characters.
    • Result: { devices: [{ phoneKey, deviceId, token }] }.
    • For each phone it creates or returns an ordinary mobile-scope device, storing its parent and
      phoneKey. Children the caller no longer lists are revoked through the normal phone revoke path.
    • Only a desktop paired to this server can call it, and only for its own children. Phones are refused.
  • Children are never "pending", so the server's own pairing QR can't hand one out or delete it.
    They inherit the desktop's pairing reach, so the server never binds more widely.
  • Revoking the desktop removes its phones. If a phone's cleanup can't be saved, the desktop is kept so
    a retry still reaches it. A sync that can't revoke a dropped phone fails instead of reporting success.
  • Capability pairing.delegated-mobile-devices.v1 is advertised, so a desktop can detect support.
  • Mechanism: the existing phone-revoke code moved, unchanged, into its own layer
    (runtime-rpc-mobile-devices.ts) below the request dispatch layer. Dispatch then gives the handler a
    caller-bound delegatedMobileDevices.sync, the same way it already gives the relay pairing calls their
    caller. A shared mintDeviceCredential() mints tokens for both paths.

Why

Making each phone a real phone device on the server reuses everything the server already does for
phones, and no request handler changes. The rejected alternative taught the server a new "viewer acting
for a desktop" identity, which would have needed plumbing across several identity fields and request
params. One sync call that names the full phone list is simpler than separate add, remove and list
requests: the desktop holds tokens only in memory and re-syncs on connect, so nothing needs cleanup on
the desktop.

Linked Issue

N/A (maintainer)

Visual Proof

N/A. Server-side only; nothing calls it yet.

Testing

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

delegated-mobile-device.integration.test.ts uses the real dispatch, the encrypted client and the
registry. It has 12 tests:

  • the capability is advertised;
  • a child signs in as a real phone, with the phone allowlist enforced and a distinct device id;
  • sync is idempotent;
  • phones and local callers are refused;
  • children inherit pairing reach;
  • creating or rotating the QR never touches children;
  • a shorter list revokes the dropped child and closes its socket;
  • revoking the parent cascades, and another desktop's children survive;
  • the parent is kept when a child's cleanup can't be saved;
  • a sync whose dropped child can't be revoked fails;
  • children survive a registry reload;
  • rename, duplicate phoneKey and the 32-phone limit;
  • an old registry file loads.

Each protection was checked by breaking it on purpose: its test fails. The related suites pass:
133 tests across 19 files on the reviewer's run, and 501 across 65 files on the lane's.

Notes

  • Removing a relayed phone on the server: removing one of these phones from the server's
    paired-devices list doesn't stick, because the desktop's next sync re-creates it. Unpair the phone from
    the desktop to remove it everywhere.
  • Downgrades: an older server reloads its registry without the parent link, so these phones become
    ordinary standalone devices that revoking the desktop no longer removes. After upgrading again, the
    next sync creates fresh ones, and the old ones remain until revoked by hand. An older server also
    doesn't advertise the capability, so desktops stop syncing to it.
  • Security: the request is runtime-scope only, bound to the authenticated caller, and absent from
    the phone allowlist. Tokens appear only in the encrypted reply.

…mobile devices

A desktop paired to this runtime can now call pairing.delegatedMobileDevice.sync to make each of
its phones an ordinary mobile-scope device it owns, so the phone mirrors that host through the
desktop. Children are never pending, inherit the parent's reach, and die with the parent's grant.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…atch

Dispatch binds the caller-bound delegated-device context, so the revoke path it needs now lives in
a layer under it as a pure move; this drops the abstract method seam. No behaviour change.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…oked

A failed child cleanup now leaves the parent in place so a retry can still find the children, and
revokeRuntimeAccess lives beside the revoke it cascades to. Adds restart, rename and bounds coverage,
shares credential minting, and drops the timing-dependent census.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…oked

Matches the parent revoke: a child whose cleanup could not be saved is kept and the sync errors
before minting anything, so the desktop retries instead of believing the server matches its list.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⛔ Files ignored due to path filters (1)
  • src/shared/rpc-contract/rpc-params-catalog.generated.ts is excluded by !**/*.generated.*

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 549932d6-a5da-41c1-a7fa-dbfa3f0737a8

📥 Commits

Reviewing files that changed from the base of the PR and between cbc38b5 and 8d60648.


⛔ Files ignored due to path filters (1)
  • src/shared/rpc-contract/rpc-params-catalog.generated.ts is excluded by !**/*.generated.*

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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 81e7e090-bea5-42a6-bc1e-a2b6146be611


📥 Commits

Reviewing files that changed from the base of the PR and between 364bc23 and cbc38b5.



📒 Files selected for processing (4)
  • src/main/runtime/delegated-mobile-device.integration.test.ts
  • src/main/runtime/rpc/methods/pairing.ts
  • src/main/runtime/rpc/rpc-caller-scope.ts
  • src/main/runtime/runtime-rpc/runtime-rpc-websocket-dispatch.ts


🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/runtime/rpc/methods/pairing.ts


Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.




📝 Walkthrough
📝 Walkthrough

Walkthrough

Adds a runtime RPC for synchronizing delegated mobile devices. The registry stores parent-device and phone-key links, reuses matching child devices, and persists new or renamed entries. Runtime handling revokes removed children and supports parent revocation. The change also adds credential and registry validation helpers, advertises the runtime capability, and adds integration tests for synchronization, revocation, persistence, and compatibility.



Priority: ➖ Normal

Merge Risk: 🔵 Low · up to cbc38

Delegated phones can be saved with blank display names. Reject or normalize those names before merging, or accept this limited risk as a follow-up.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 26.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 15 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: allowing a paired desktop to register its phones as phone devices.
Description check Passed The description is mostly complete. It explains the user-facing behavior, mechanism, rationale, security constraints, compatibility considerations, testing, and the maintainer exception for the linked…
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.



✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR


🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR

  • Autopilot · 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

Comment @coderabbitai help to get the list of available commands.

…d-mobile-devices

Conflicts resolved: keep both capability lists and DeviceEntry fields; take
main's rpcContextFromTransport and add delegatedMobileDevices to it; drop
the revoke methods main kept in runtime-rpc-pairing (this branch moved them).
The sync method declares main's new required permission as 'workspace',
since paired desktops never hold pairing-admin. Grant and relay-binding row
validation moves to its own file so device-registry stays under max-lines.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

@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
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a5cf522c-1a47-4476-8951-8f93a230a087
📥 Commits

Reviewing files that changed from the base of the PR and between a680a40 and 364bc23.

⛔ Files ignored due to path filters (1)
  • src/shared/rpc-contract/rpc-params-catalog.generated.ts is excluded by !**/*.generated.*
📒 Files selected for processing (8)
  • src/main/runtime/device-registry-row-validation.ts
  • src/main/runtime/device-registry.ts
  • src/main/runtime/rpc/core.ts
  • src/main/runtime/rpc/dispatcher-stream-options.ts
  • src/main/runtime/rpc/methods/pairing.ts
  • src/main/runtime/runtime-rpc/runtime-rpc-pairing.ts
  • src/main/runtime/runtime-rpc/runtime-rpc-websocket-dispatch.ts
  • src/shared/protocol-version.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

parent: DeviceEntry,
phones: readonly DelegatedPhone[]
): DelegatedMobileDeviceEntry[] {
const { nextDevices, entries } = planDelegatedMobileDevices(this.devices, parent, phones)

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Reject blank delegated-device names in the registry.

If a desktop sends name: ' ', the RPC schema accepts it and planDelegatedMobileDevices persists it unchanged. Validate and trim names before this registry operation saves new or renamed children. This prevents blank names in the paired-device list. (raw.githubusercontent.com)

Based on learnings: “name validation and normalization (trimming, rejecting blank/whitespace-only) must happen inside the storage layer itself.”

Source: Learnings

…ed desktop

A delegated child phone could call the mobile-allowlisted pairing-admin methods
(push registration, relay provisioning) that its parent desktop is never granted.
The caller scope now marks delegated phones and denies them that permission.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
@Jinwoo-H
Jinwoo-H merged commit de00a4f into main Oct 11, 2026
31 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