Repository navigation
fix(android): keep retained USB handles in their original request - #1032
Merged
Merged
Conversation
Signed-off-by: egerev <egor@gosync.ai>
Signed-off-by: egerev <egor@gosync.ai>
egerev
marked this pull request as ready for review
November 17, 2026 08:41
egerev
enabled auto-merge
November 17, 2026 08:41
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.
An order-event connector can finish after USB loss before its successful foreground run is retained for supervision. Its
Entry.handleis still unset. The later handle belongs to the same original request, but refresh compared Python object identity and treated it as a new acquisition. An attempt while unplugged can leave an unknown forward and block the next ordinary request.Recognize the retained handle by its original request ID as well, preserving distinct foreground-generation admission. Retaining that request never reacquires its ended connector. A distinct admitted request can still acquire once and supersede the old collection only after its own positive watch reply. Current owner/device/source/epoch/session checks, receipts, uncertain cleanup and one-acquisition rules remain; no reset, retry, grant or protocol change.
A new real-service regression orders watch establishment → USB loss/connector finish → retention with event barriers. On the exact parent source it fails because the original entry is replaced. With this fix it preserves the entry, performs no extra acquisition, then reconnects through a distinct ordinary request and closes the original collection. This reproduces a concrete race behind the reconnect failure pattern in run44045047078; that historical CI log has no private forward-state dump, so it cannot uniquely identify its internal interleaving.
Validation: the new case fails first (1.19s); all 33 related USB/recovery/admission tests pass after, with existing tests unchanged. Size-budget tests (5) and Ruff pass; source is326 lines, below the budget threshold. No timeout increase, skip/xfail, existing test-identity change or unchanged CI retry. No live phone/ADB/model/provider action. The owner-authorized BB channel rollout remains separate.
Spec: ANYM-997
Change path: AUTO (request identity correction; no permissions, configuration, migration or live action)
Review record: none (owner 11-11: no reviews)