Repository navigation
fix(android): preserve QR pairing when setup permissions change - #157569
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 24, 2026, 5:18 PM ET / 21:18 UTC (Revision 3). ClawSweeper reviewWhat this changesThe Android companion app defers capability-triggered Gateway reconnection until QR setup credentials are saved, with a loopback WebSocket regression covering the handoff. Merge readiness✅ Ready for maintainer review Keep open. Current main still reconnects during the one-use setup credential exchange, and this PR addresses that race with a focused regression. I found no actionable defect in the introduced patch. Priority: P1 Review scores
Verification
How this fits togetherThe Android app uses a QR or setup code to connect to the Gateway and save permanent node and operator credentials. Permission changes alter the capabilities advertised on that connection and can trigger a reconnect. flowchart LR
A[QR setup code] --> B[Android Gateway connection]
C[Permission change] --> D{Setup handoff complete?}
B --> D
D -->|No| E[Keep setup socket]
E --> F[Save device credentials]
F --> G[Reconnect with current capabilities]
D -->|Yes| G
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +213, Other +14. Total +227 across 2 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Preserve the in-flight setup handoff, reconnect with current capabilities after durable credentials arrive, and show an inline pairing recovery action if a setup code has already expired. Do we have a high-confidence way to reproduce the issue? Yes, from source and the submitted regression: a capability refresh can replace the socket after the Gateway consumes the one-use code but before Android receives durable role credentials. I did not execute the regression in this read-only checkout. Is this the best way to solve the issue? Yes. Deferring the internal reconnect at the Android connection owner is a narrow repair that leaves credential issuance and storage contracts intact. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 30e67dbd5fe6. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Merged via squash auto-merge.
|
Backport #157569: 0179bdb Backport #157865: ebdf8ab Keep the consumed bootstrap handoff alive until durable grants are accepted and retry owed transcript invalidations under captured connection/session/agent ownership. Preserve physical-enqueue fences and the earlier Sidebar CI fixture repair. Both real fixture entrypoints failed before repair; 157 focused cases and i18n checks pass. Independent review is clean. JVM/local-WebSocket proof is not live QR, permission, emulator, relaunch or token-rotation qualification. Co-authored-by: Jason (Json) <[email protected]> Co-authored-by: Dallin Romney <[email protected]> Co-authored-by: RomneyDa <[email protected]> Co-authored-by: vyctorbrzezowski <[email protected]> Co-authored-by: steipete <[email protected]> Co-authored-by: jalehman <[email protected]>
What Problem This Solves
Fixes Android QR pairing failing when a permission or capability changes while the gateway is exchanging the one-use setup credential for permanent device credentials.
User Impact
Users can finish setup without a camera-permission change interrupting pairing and leaving the app retrying a consumed setup credential. No credential format, approval policy, or migration changes; explicit disconnect and replacement setup still take effect.
This fixes a reproduced setup race. It does not claim to explain every previously reported disconnect or prove overnight/network-transition recovery.
Why This Change Was Made
Keep the in-flight bootstrap connection alive during internal capability refreshes. After the credential handoff completes, reconnect with the saved device credentials and latest capabilities. Connection-identity checks prevent a deferred refresh from replacing a newer setup attempt.
Evidence
NodeRuntime.configureGatewayAndConnectpath and a loopback WebSocket gateway: consume bootstrap, hold the response, enable camera, then return both role grants. It failed before the fix and passes afterward, verifying permanent authentication, refreshed camera capability, bootstrap retirement, and access after recreating runtime/preferences.GatewayBootstrapRefreshTest,GatewayBootstrapAuthTest,GatewaySessionInvokeTest, andDeviceAuthStoreTest. The new regression took 0.114 seconds in JUnit; the combined Gradle test/lint invocation took 1m56s. Current-head hosted Android test steps passed: Play 554 seconds, third-party 596 seconds, and Wear 611 seconds (whole-step durations, not the new test alone).pnpm android:i18n:check, andgit diff --checkpassed. Fourteen selected local guard stages passed across the initial run and a repaired tooling continuation, not one clean aggregate invocation.The published patch has the same reviewed production/test bytes. An unrelated local parent commit was excluded before publication. Exact-head CI passed for the unchanged reviewed head: both Android app test variants, Wear tests, ktlint, i18n, security-fast, and native Access crypto on 4 KiB and 16 KiB Android emulators. The ktlint step took 433 seconds; native Access steps took 506 and 527 seconds. Attempt 1 was deferred before tests by Full Release Validation. After its owner cleared runner priority, attempt 2 ran the full selected CI and passed; no product change or blind rerun was used to clear a test failure.