Repository navigation
fix(pairing): stop the phone approving a TV that cancelled sign-in - #749
Conversation
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. |
|
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 57 minutes. View limit details
|
|
The TV-pairing confirmation now disappears and shows a failure when the TV cancels, disconnects, or reports failure. The linked evidence and validation notes cover the Android phone, but not the Android tablet or foldable folded and open; please add a short recording of the cancellation flow on those devices, since the change reaches them through the phone app. The code is wired only into the phone app, so Android TV is not an affected surface. Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness. Posted via Macroscope — Visible change evidence |
|
The Evidence section still needs the affected-device coverage required by CONTRIBUTING.md: before-and-after captures on an Android tablet and a foldable, folded and open, plus a short recording showing TV cancellation removing the phone's comparison buttons. The body says tablets share the changed coordinator and card, so that does not establish that they are unaffected. If a device cannot reach this flow, explain that instead. AI disclosure: openai/gpt-6.1-sol via OpenClaw (Silo Triage); triage only, no code execution. |
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:
|
|
The cancellation flow in Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness. Posted via Macroscope — Visible change evidence |
|
Evidence updated: tablet and foldable (folded and open) before/after captures of the code step and of the card after the TV cancels, plus a short phone recording of the cancellation. Devices: Pixel 8 phone, Pixel Tablet and Pixel Fold emulators (API 34) with an Android TV emulator. Before is |
Once a TV ends a phone sign-in attempt (it cancels, hangs up, or reports the server failed), the phone no longer approves or denies its request. The code-comparison card stops waiting for an answer at once, and every decision point checks the TV's side first. A signed-out TV keeps its own sign-in request after cancelling, so a late "Yes" used to sign it in and a late "Doesn't match" denied its live code. Closes #738 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Leaving the confirmation scope waits for the cancelled watcher, and the TV can end the attempt in that time; declining then would deny the request the TV still shows. Check again right before the decline, as before the approval. Co-Authored-By: Claude Opus 5.5 <[email protected]>
a7000ea to
968e9cf
Compare
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:
|
| // The TV hung up (or the read failed): wake any wait | ||
| // for its next message instead of sitting on it until | ||
| // the step's timeout. | ||
| peer.ended() |
There was a problem hiding this comment.
Server-selection hang occurs when the incoming flow completes normally while chooseServers(orderedServers) awaits UI input: recording transport closure with peer.ended() only wakes the match-confirmation interruption watcher, and normal collector completion and closing inbox do not cancel the separate UI wait, leaving the phone stuck after the TV disconnects. Propagate unexpected transport completion to the entire pairing operation, or race server selection against peer termination and cancel the pending selection when termination wins; add a regression test for clean EOF during server selection.
Kody rule violation: Propagate transport closure to pending interaction and preserve terminal failures
Prompt for LLM
File android-shared/src/androidMain/kotlin/org/siloserver/silo/common/pairing/CompanionPairingCoordinator.kt:
Line 324:
Server-selection hang occurs when the incoming flow completes normally while `chooseServers(orderedServers)` awaits UI input: recording transport closure with `peer.ended()` only wakes the match-confirmation interruption watcher, and normal collector completion and closing `inbox` do not cancel the separate UI wait, leaving the phone stuck after the TV disconnects. Propagate unexpected transport completion to the entire pairing operation, or race server selection against peer termination and cancel the pending selection when termination wins; add a regression test for clean EOF during server selection.
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.
Problem
Closes #738
Related issue: Silo-Server/silo-server#1192
Validation tasks: changes #336 C1; changes #337 C2; changes Silo-Server/silo-apple#327 C2
When an Android phone or tablet signs in a TV that sits on its sign-in screen, and the person at the TV chooses Allow and then Cancel while the phone shows the code to compare, the phone kept "Yes, this matches" on screen. Tapping it approved the TV's sign-in request, and the TV signed in even though its user had cancelled. A signed-out Apple TV or Android TV keeps that request alive after cancelling the phone attempt (it is the same code shown on screen and in the QR), so the late approval lands. A late "Doesn't match" had the opposite problem: it denied the TV's live code and then showed a raw TLS error.
iPhone and iPad already stop as soon as the TV cancels. This change brings Android phones and tablets in line: once the TV ends the attempt, the phone stops at once and sends no approval or denial.
Approach
CompanionPairingCoordinatorread the TV's messages only when it next waited for one, which came after the approve call. The coordinator now records, as messages arrive, anything that ends the TV's side of an attempt: acancel, the connection closing, or a failed result for the server being signed in (for example, the TV's code expired while the phone was showing it). The code comparison races the person's answer against that signal, so the card's buttons go away as soon as the TV leaves. Every point that would approve or deny on the server checks it first, including the lookup step, the mismatch denial, and later servers that are approved without asking.The phone's failure text is unchanged. For a TV that hangs up without sending
cancelit still reads " closed the connection. Try again."; #669 covers that wording. A phone that has already sent its approval cannot take it back. The change stops decisions made after the phone knows the TV left.No Apple change is needed: the iOS sender already concludes on
cancel, stream end, and failed results.Validation
./gradlew testDebugUnitTest, the five lint tasks, and bothassembleDebugbuilds pass. The two supply-chain scripts could not run locally becauserubyis missing; this change touches no build or workflow files, so CI runs them.Evidence
Evidence: https://evidence.siloserver.org/r/silo-android/issue-738/
Surface and build: Android phone emulator (API 34) as the sender; Android TV emulator (API 34) and Apple TV simulator (tvOS 27) as receivers; silo-server sandbox at
9d3f24ca.Risks
None identified. The change adds no settings or protocol messages. A failed
ServerResultfor the active server now ends the comparison early with the TV's reason instead of after the approve call.Checklist
AI Disclosure
🤖 Generated with Claude Code
Note
Fix phone approving a TV pairing attempt that already cancelled
PeerStatetracker inCompanionPairingCoordinator.pairthat records incoming TV cancellations, connection closure, and failed server results as they arrive, instead of only noticing them when the inbox is next read.PeerInterruption.failuremaps recorded interruptions to the matching exception types:PeerCancelledException, a connection-closed exception, or anIllegalStateExceptionwith the server failure message.Macroscope summarized 968e9cf.