Repository navigation
fix(android): a request whose USB entry ended never reacquires through its retained handle - #1044
Merged
egerev merged 1 commit intoNov 18, 2026
Conversation
…h its retained handle UsbLifecycle.refresh recorded only entries that ended before claiming the serial. A request whose connector ended after USB loss could acquire again through its retained handle as soon as a different request's entry was the previous one and ended, contrary to the one-acquisition-per-request contract (#1032: retaining that request never reacquires its ended connector). Record every ended entry's (owner, request) in the existing ended set and refuse those candidates on the settled path as on the untouched path. A genuinely different, ordinarily admitted request still acquires once and supersedes the held collection. Receipts, cleanup, lease, epoch and admission checks are unchanged; nothing is retried or reset. Spec: ANYM-997 Signed-off-by: egerev <egor@gosync.ai> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
egerev
deleted the
bb/usb-ended-request-never-reacquires-thr_ngb3g9karf
branch
November 18, 2026 11:32
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.
UsbLifecycle.refreshrecorded only entries that ended before claiming the serial (#1036). A request whose connector ended after USB loss could acquire again through its retained handle once a different request's entry became the previous one and ended. The #1032 contract says "retaining that request never reacquires its ended connector", and the code says one acquisition per generation.Change (
refreshonly, +7/−8). Every ended entry's (owner, request) goes into the existingendedset. The settled path refuses those candidates, as the untouched path already did. This also covers the earlier same-task handle check. No new state store, retry, reset, grant, config or identity substitution. Receipt, cleanup, lease, epoch and admission checks are unchanged.Accepted consequence (root). An ended request's handle cannot resume phone collection just because its old order is still active. A genuinely different, ordinarily admitted request still acquires once and supersedes.
New regression
test_usb_ended_request_never_reacquires.py. Request A ends on USB loss. B reconnects, supersedes A's row, then ends on a second USB loss. Both handles stay retained with active orders, because no notification is replayed. Over 25 counted real supervision ticks (no sleep), neither acquires. A different request C then acquires exactly once and supersedes.Validation.
order_usb_host.pyis 340 lines and the change-path greps are empty. No existing test path, name, parameter, deadline or assertion changed.Spec: ANYM-997
Change path: AUTO (lifecycle admission bookkeeping; no permissions, configuration, migration or live action)
Review record: none (owner 11-11: no reviews)
🤖 Generated with Claude Code