Repository navigation
Make a paired iPhone an approver - #353
Merged
Merged
Conversation
Cross adversarial reviewGPT-6 Astra (xhigh) and Opus 5.5 (xhigh) reviewed this change read-only, two rounds each, at f5ec3be. In round 2 they swapped reports and also reviewed the round 1 fix diff (d06df0b). Neither reported a P0 or P1 in either round. Both checked the same things:
Fixed
Declined
The review directories are deleted. |
Pairing a macOS initiator with an iOS responder now writes the approval flag in the add on both sides (ADR 0014, amendment of #336). The Vault accepts the flag only in an add that pairing authorized for an iOS card and refuses any change to a stored entry's flag; the approver authorization is gone. The Mac adds a newly paired iPhone alone to the Broker's active-approver set as soon as it learns of the add, and adds any flagged entry missing from the set at every list read with the services ready and the account available. A pairing ID whose removal began never joins the set again. Requests pending before the first pairing stay on the Mac. The approval switch, the approver sheet, its system authentication, disableApprover and the confirmation state machine are removed; Remove is how approval stops. The Mac pairing sheet says before the QR code, and again before system authentication with what a request sends, that the iPhone will approve agent requests; the Devices row says whether an iPhone approves. The iPhone's code screen, Face ID reason and paired state say the same. The required flow that clicked the switch is replaced by one that checks the row's approval text and removes the iPhone (still 18 flows). Closes #341
Review fixes for #341. Reloading the active-approver set after a suspension now skips a pairing ID whose removal began, as the per-entry paths already did, so a removal whose write failed or is pending cannot come back after an account change. The Vault treats an entry as stored only when its card matches too, so a write cannot swap the card, and with it the approval key, under a flag that pairing granted.
Second-round review fixes for #341. When the add of a session that ended during the write cannot be removed, the messenger keeps the rollback and retries it from advanceTimers() until it commits, so a cancelled pairing does not leave a flagged entry behind for the next launch. Before adding an approver to the active-approver set, the coordinator tracks every pending request against the set as it was, so a request whose Broker notification has not arrived yet stays on the Mac.
sudoHG
force-pushed
the
sudoHG/pairing-makes-approver-6cc9a4
branch
from
November 15, 2026 14:42
0852c91 to
ab63a24
Compare
|
Rebased onto main 650bf0a (after #340 and #352). The new head ab63a24 adds one test fix: #340's |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Implements ADR 0014 → "Amendment: pairing makes an iPhone an approver (#336)" → Implementation tasks → 1. Closes #341.
AskKeyDevices).PairingSession.entry(pairedAt:)sets the approval flag when the initiator's card says macOS and the responder's says iOS, on both sides;.addstores the entry's flag as given. Pairing layouts, labels and vectors are unchanged.approverNotAuthorizedotherwise); any change to a stored entry's flag is refused.authorizeDeviceApprover,endDeviceApproverAuthorizationand the approver authorization inVaultDeviceStateare removed.pairingAdded(_:)adds a new pairing ID alone as soon as the coordinator sees the paired phase;reconcileActiveApprovers(with:)adds every flagged entry missing from the set at each list read while the services are ready and the account is available. Both useactivateStoredApprovers(only:). The confirmation state machine, its polling,disableApprover,ApproverConfirmationState,ApproverAttemptand the code's log events are gone; a kind 14 message is refused asunexpectedKind.approveDevice) are removed. The pairing sheet, the Devices row, Remove's confirmation and the pairing reason carry the decision 5 statements. On the iPhone, the code screen, the Face ID reason and the confirmed and paired states do too.testApproveAgentRequestsTurnsOnWithTheCodeTypedOnTheIPhoneis replaced bytestPairedIPhoneApprovesAgentRequestsUntilRemoved: pair, check the row's approval text, Remove, confirm, check the row is gone. Still 18 flows.Statements for wording review
Glossary: the Chinese UI term for Approver is now 可以审批 Agent 请求, pending the same approval.
Renders
RemoteApprovalRenderTests(CI artifactaskkey-remote-approval-renders, 30 PNGs, en and zh):01-devices-iphone-approves,02-devices-iphone-cannot-approve(flagged and unflagged rows together),03-devices-remove-confirmation,04-pairing-qr-code,05-pairing-waiting,06-pairing-code-entry,07-pairing-code-accepted,08-pairing-authenticating,09-pairing-waiting-for-iphone,10-pairing-paired, plus the unchanged 11–15.makeWindowwithSettingsView(navigation:)asensureManagementWindowbuilds it, andapply(to:)), scrolled to Devices:16-en-settings-window-devices,16-zh-settings-window-devices. Rendered locally only (REMOTE_APPROVAL_WINDOW_RENDERS=1), because a programmatic scroll draws an empty column on the CI runner (184335b).askkey-basic-ui-evidence):42-en-devices-pairing-paired,43-en-devices-remove-confirmation,44-zh-devices-pairing-paired,45-zh-devices-remove-confirmation.ScreenRenderTests(CI artifactaskkey-ios-screens):06-pairing-code,07-pairing-face-id-cancelled,08-pairing-confirmed,10-pairing-paired, in en and zh-Hans.Every render is checked for more than eight colors.
Diff stat
git diff --stat origin/main: 50 files changed, 1112 insertions(+), 1995 deletions(-).Tests
Local, on 0852c91 (head, after both review rounds):
swift build: passed.swift test --filter "AskKeyDevicesTests|AskKeyVaultTests|AskKeyAppTests": AskKeyDevicesTests 221 passed (main 216); AskKeyVaultTests 579 passed, 17 skipped (main 581: the approver-authorization tests went, the write-rule tests are new); AskKeyAppTests 836 passed, 1 skipped, 0 failed (main about 847: 20 approver-sheet and confirmation tests deleted, 11RemoteApprovalPairingTestsadded). On f5ec3be,AgentClientConnectionExecutionTests.testFailedConcurrentCursorConnectionDoesNotUndoSuccessfulConnectionfailed once in a combined run and passed alone; it is a timing test unrelated to this change.bash scripts/build-ios.sh test(on f5ec3be; no iPhone file changed since): AskKeyiOSKitTests 137 passed (main 136, +1), AskKeyiOSNotificationServiceTests 44 passed, 86 screens rendered.basic-ui-flows(desktop E2E) runs in CI only, as AGENTS.md requires.Checks
python3 scripts/check_hygiene.py: passed (size, test-support, debug, local-path, non-ascii-name, multica and cjk all 0).python3 scripts/check_module_deps.py: passed.DeviceCoordinator.swift, 570).Deviations and questions
reconcileRemoteRequests()now runs without device services, andstopRemoteApproval()keeps pending requests as staying-on-Mac markers instead of dropping them. Without this, a request created before the Mac had an identity was first seen after the first pairing and sent to the new iPhone, against "a request that was not eligible then ... stays on the Mac ... which includes every request pending while the first iPhone pairs".deviceWillBeRemovedrecords the pairing ID inrevokedApprovers, and neitherpairingAddednor reconciliation adds it again. Between the removal hook and the list write, a list read still sees the entry; without this it could join the set again until the Vault's write removed it.ApproverTestsand the two "without the flag" tests inApprovalRequestTestsnow rewrite the Mac's entry without the flag first (storeWithoutApprovalFlag, default initializer), as a pre-Amend ADR 0014: pairing an iPhone makes it an approver #336 entry. iPhone: retire Approve Requests from This Mac and Stop Approving #342 removes those flows.SimulatedPairingPhone.confirmApprover(typing:for:)becamesendRetiredApproverConfirmation(to:), used bytestARetiredApproverConfirmationIsRefusedAsAnUnexpectedKind. AskKeyDevices: reserve kind 14 and remove the approver code #343 removes it with kind 14. The.confirmationarms,ApproverCode,setApproverand their AskKeyDevices tests stay for AskKeyDevices: reserve kind 14 and remove the approver code #343.42–43, zh44–45replace42–47);docs/testing.mdlists them.ScreenRenderTestsunchanged. Its pairing screens06,07,08and10already show the new statement.advanceTimers()(DeviceMessenger); and the coordinator tracks pending requests against the set before every addition, so a request whose Broker notification has not arrived stays on the Mac. The review summary follows in a comment.