Repository navigation
fix(tv): drop a silent phone after three minutes of phone setup - #748
Conversation
A phone that lost its network while the Android TV asked "Allow this setup?" kept the TV waiting forever, and the TV refused every other phone meanwhile. The receiver now closes a session that has been silent for 180 seconds (the Apple TV and Roku limit) and goes back to waiting. The timer pauses while a sign-in attempt is in flight, and expiry never starts a new attempt. Closes #739 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:
|
|
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 55 minutes. View limit details
|
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 timeout also affects the phone sender: if someone leaves server selection open for three minutes, the TV closes the session and the phone can report a setup failure when it sends. The evidence description names only an Android TV emulator. Please add a short recording of this timing/disconnect flow on an Android phone, tablet, and foldable both folded and open, or explain why those phone surfaces cannot be reached. The evidence page should also let reviewers check the Android TV timeout flow. Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness. Posted via Macroscope — Visible change evidence |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9c4afedfc1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Quick104
left a comment
There was a problem hiding this comment.
Adversarial review (gpt-6.1-sol, reviewed 9c4afed)
Two findings below. F1 independently confirms the existing socket-close finding; F2 concerns the Android phone chooser after idle expiry.
AI disclosure: Reviewed with Codex, gpt-6.1-sol.
Closing the real socket ends the phone stream with an error, not a clean end, and that path dropped a lone failure. Also hold the idle timer for the whole attempt, and check the timer still owns its session after the wait. 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:
|
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 #739
Related issue: Silo-Server/silo-server#1192
Validation tasks: changes #337 C2 (not yet run)
If a phone loses its network while an Android TV asks "Allow this setup?", the TV waits for that phone forever. It serves one phone at a time, so it also turns away every other phone or tablet ("Setup didn't finish", "Connection reset") until someone presses Don't allow on the TV. The Apple TV and Roku apps give up on a silent phone after 180 seconds; the Android TV app had no limit.
Approach
PairingReceivernow closes a phone session that has been silent for 180 seconds and returns to waiting, so the next phone can connect. It uses the same rules as the tvOSReceiverPairingCoordinator:Only
PairingReceiver.ktchanges. iOS and tvOS already behave this way. Android phones are senders, so they are unaffected.Validation
main): 3 min 28 s after the cut the TV was still on "Allow this setup?", and it refused a second connection as busy.PairingReceiverTestcases fail onmainand pass here: a silent phone is dropped at the limit (and a late Allow starts nothing), and the limit restarts after an attempt ends, keeping its failure../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-739/
Surface and build: Android TV emulator (Android 14), debug builds of
mainand this branch. Phones and tablets don't run the receiver.Risks
A phone that sends nothing for three minutes while the TV waits for consent now gets disconnected, which matches tvOS and Roku. Sign-in attempts in flight are not timed out. An Android phone left on its server chooser for three minutes keeps showing the chooser after the TV drops it, which already happens with Apple TV and Roku; that's filed as #750. The parallel fix for #667 also edits
PairingReceiver.kt, so whichever merges second may need a rebase.Checklist
AI Disclosure
9c4afedfc) raised two findings, and Kody raised three. Fixed in90774f2fd: a failure is kept when the real socket's close ends the stream with an error, inbound messages no longer restart the timer during an attempt, and the timer checks it still owns its session after the wait. The phone-side chooser finding isn't new; it's filed as [bug] Android phone keeps the server chooser open after the TV drops the setup connection #750. Nothing is left open.🤖 Generated with Claude Code
Note
Drop silent phone after 180 seconds of inactivity in
PairingReceiverFailedsession status.Allowdoes not start device login.Macroscope summarized 743a62c.