Repository navigation
fix(tv): withdraw the sign-in request when a phone abandons setup - #752
Conversation
When a phone cancelled phone setup of an Android TV (an iPhone's "Doesn't match", for one), or its connection dropped, the TV went back to waiting but left the device-login request it had opened on the server pending, so its code could still be approved for up to 15 minutes. The receiver now withdraws a request it opened and didn't collect, following the shared withdraw rule DeviceSignInMachine uses. The sign-in screen's own request, which the TV keeps showing, is never withdrawn. Closes #667 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Next included review available in 5 minutes. View limit details
Comment |
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
The TV-side withdrawal changes what the Android phone app’s “Sign in a TV” lookup offers for an abandoned code ( Suggested fix: Add those phone-form-factor captures and the flow recording to the evidence page. Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness. Posted via Macroscope — Visible change evidence |
…et it A save that outlives its connection could otherwise read and withdraw the request a newer attempt opened after the advertiser restarted. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
|
Evidence updated: phone, tablet and foldable (folded and open) before/after captures of the abandoned code typed into Sign in a TV: before it is offered for approval, after it is refused. Devices: Pixel 8 phone, Pixel Tablet and Pixel Fold emulators (API 34) with an Android TV emulator on its first-run screen. Before is TV |
Resolves the conflicts with #752 (withdraw an abandoned sign-in request) in PairingReceiver.kt and PairingReceiverTest.kt. Both behaviours hold: - Imports and companion: keep IDLE_TIMEOUT (180 s) next to #752's WITHDRAW_TIMEOUT, and both sets of coroutine imports. - Fields: keep the idle timer state (idleJob, sessionClosing, sessionLock) next to #752's deviceLoginOwner/deviceLoginLock. - startAttempt: keep this branch's sessionLock block (no attempt starts once the session is closing, the idle timer pauses while an attempt runs and restarts only after a finished one). Drop the branch's try/finally deviceLogin.reset() around runAttempt: #752 moved that reset into runAttempt's finally, where only the attempt that still owns the shared state resets it and then withdraws its request. The withdraw runs inside the attempt, so the idle timer restarts after it. - Tests: keep both branches' new PairingReceiverTest cases. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Problem
Closes #667
Related issue: Silo-Server/silo-server#1192
Validation tasks: changes #337 C2 (not yet run)
When an iPhone or iPad cancels phone setup of an Android TV (for example after the person taps Doesn't match), the TV goes back to "Set up with your phone" but leaves the sign-in request it opened on the server pending. For up to 15 minutes,
/activateand the Sign in a TV screen still offer to approve it, and approving says the TV is signing in, though the TV has moved on. The same happens when the phone's connection drops mid-setup. An Android phone hides this by denying the request itself; the Apple TV withdraws its own request.Approach
In setup mode,
PairingReceivernow tracks the request each attempt opens. When the attempt is abandoned before the TV collects it, the TV withdraws it withPOST /api/v2/auth/device/cancel. That covers a phone cancel, a dropped connection, a newer push, and Cancel on the TV. This mirrors the tvOSReceiverPairingCoordinator:DeviceLoginPort.withdrawfollows the ruleDeviceSignInMachineuses. It skips only a server whose capability says it has no cancel. A capability read that fails or takes over two seconds counts as unknown, and the cancel is still sent.Sign-in mode is unchanged. When the TV is on its sign-in screen, it lends the code it is already showing to the phone and never opens a second request. When the phone cancels there, that code stays on screen, still waiting for approval, and stays approvable. The Apple TV does the same: its
handleLoginPushhas no withdraw, and the sign-in screen goes on polling its own request.Validation
cancelwith reasonmatch_declinedand no deny. I replayed the frames because the iOS simulator available for this run couldn't discover TVs. See Evidence.main): after the cancel, the TV's request stayedpendingand approvable until it expired.canceled0.4 s after the cancel. Rechecked on the current head after each review fix.pending.PairingReceiverTesttable: a phone cancel or a dropped connection withdraws, while a server deny or a cancel in sign-in mode doesn't. It can't run onmainbecause the fake implements the new port method, so the live run is the before-and-after proof. A second new test, in which an attempt still saving after a restart leaves the newer request alone, fails on the PR's earlier head and passes on the current one../gradlew testDebugUnitTestand the CONTRIBUTING lint set pass. I did not run the two supply-chain scripts locally because they need Ruby, which this machine lacks. No build files change.Evidence
Evidence: https://evidence.siloserver.org/r/silo-android/issue-667/
Surface and build: Android TV emulator (Android 14), debug builds of
mainand this branch. The TV's screens look the same before and after; the change is the request's state on the server, recorded in the evidence notes.Risks
None identified beyond a best-effort network call on teardown (at most five seconds, off the main thread). This PR and #748 both edit
PairingReceiver.ktin different functions, so whichever merges second may need a rebase.Checklist
AI Disclosure
3180f6518) and Kody found that an attempt still saving its session after an advertiser restart could read, withdraw and reset a newer attempt's request. Fixed inee0323a76with attempt ownership of the shared state, plus a regression test. Nothing is left open.🤖 Generated with Claude Code