You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(runtime): never hand a parent the token of a delegated child the save dropped - #35510
A desktop paired to a host can hand pairing credentials to its phones ("delegated" devices). Since #35483, a registry save drops a device that someone removed from the host's device file. But the function that creates or refreshes these phone devices still returned the dropped phone's token, so the desktop could pass a dead credential to the phone. Now it returns only devices that were actually saved.
What Changed
DeviceRegistry.upsertDelegatedMobileDevices filters its returned entries to the devices present after the save. That leaves out a child whose row was removed on disk, which the merged save dropped. The plan and the save are unchanged.
Why
This is e9's P3 note on #35483. Its only caller, mobile.syncDelegatedDevices in runtime-rpc-mobile-devices.ts, maps the returned entries straight to { phoneKey, deviceId, token } for the parent desktop. A dropped child is simply absent from the result. The next sync mints a fresh child for that phone, because the old row is gone from memory too.
Flag-off: no change with ORCA_INTERNAL_WSL_HOSTS unset either; this is orcad and desktop runtime registry code, independent of the flag. User-risk: low. It only changes the result in the case where an admin removed the child's row from the file while the parent was syncing. The parent then gets no token for that phone until its next sync, instead of a revoked one.
device-registry-external-edit.test.ts: a child removed on disk, then renamed through a later upsert, is not returned. It's absent from the file and its token doesn't validate. Fails on main.
The delegated-device integration (13/13) and mobile-desktop relay integration (12/12) tests pass. pnpm tc, typecheck:ci, code-quality, anti-slop and ast-grep pass.
Automated tests added/updated
Status
Ready for one reviewer.
Checklist
This PR is small and focused
I explained what changed and why
N/A for visuals with reason
Self-reviewed for correctness, security, and performance
Cross-platform, SSH/remote impact considered (registry is host-side; wire unchanged)
pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (CI runs the rest)
…save dropped
upsertDelegatedMobileDevices returned every planned entry, including a child whose row was
removed on disk and so dropped by the merged save; the parent would pass that dead token to the
phone. It now returns only entries still in the written registry.
Checks run: pnpm tc, typecheck:ci, code-quality:changed, anti-slop, oxlint, ast-grep. The new test fails on main, and the external-edit suite passes 9/9. The delegated integration (13/13) and relay integration (12/12) tests pass.
upsertDelegatedMobileDevices now returns only planned child devices whose IDs remain in the registry after the optional save. A regression test removes a child row from disk, renames the child, and verifies that the update returns no devices, the row remains absent, and the child token no longer validates.
Priority: Low
Severity of issue fixed: Low
Merge Risk: Low · up to c70c4
An externally removed child can remain unavailable until another registry-change event triggers a sync; add retry or error handling before merging.
Pre-merge checks: 5
Check name
Status
Explanation
Title check
The title clearly and concisely describes the main change: preventing a parent from receiving a delegated child token that the save removed.
Description check
The description is detailed and covers the change, reason, linked issue, visual proof, testing, and checklist. Some template sections are omitted, including Review, Agent skill upstream boundary, and …
Docstring Coverage
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Description check
Explanation
The description is detailed and covers the change, reason, linked issue, visual proof, testing, and checklist. Some template sections are omitted, including Review, Agent skill upstream boundary, and Notes, and the full required validation checklist is not marked complete, but the description is mostly complete.
Full details: Docstring Coverage
Explanation
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 2 files.
Finishing Touches
📝 Generate docstrings
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.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.
Retry phones omitted from the delegated sync response.
A successful response can omit a requested phoneKey. The cache still marks that key as answered, so later requests reuse the incomplete result. MobileDesktopRelay.open then rejects the phone without scheduling a retry.
Ensure missing phoneKey values trigger another sync, or return an error that causes the caller to retry.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
A desktop paired to a host can hand pairing credentials to its phones ("delegated" devices). Since #35483, a registry save drops a device that someone removed from the host's device file. But the function that creates or refreshes these phone devices still returned the dropped phone's token, so the desktop could pass a dead credential to the phone. Now it returns only devices that were actually saved.
What Changed
DeviceRegistry.upsertDelegatedMobileDevicesfilters its returned entries to the devices present after the save. That leaves out a child whose row was removed on disk, which the merged save dropped. The plan and the save are unchanged.Why
This is e9's P3 note on #35483. Its only caller,
mobile.syncDelegatedDevicesinruntime-rpc-mobile-devices.ts, maps the returned entries straight to{ phoneKey, deviceId, token }for the parent desktop. A dropped child is simply absent from the result. The next sync mints a fresh child for that phone, because the old row is gone from memory too.Flag-off: no change with
ORCA_INTERNAL_WSL_HOSTSunset either; this is orcad and desktop runtime registry code, independent of the flag.User-risk: low. It only changes the result in the case where an admin removed the child's row from the file while the parent was syncing. The parent then gets no token for that phone until its next sync, instead of a revoked one.
Linked Issue
Follow-up to #35483 (device registry merge).
Visual Proof
N/A: no UI.
Testing
device-registry-external-edit.test.ts: a child removed on disk, then renamed through a later upsert, is not returned. It's absent from the file and its token doesn't validate. Fails on main.pnpm tc,typecheck:ci, code-quality, anti-slop and ast-grep pass.Status
Ready for one reviewer.
Checklist
N/Afor visuals with reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (CI runs the rest)