Skip to content

fix(android): keep retained USB handles in their original request - #1032

Merged
egerev merged 2 commits into
mainfrom
bb/usb-reconnect-finish-thr_h748zsv2mq
Nov 17, 2026
Merged

egerev merged 2 commits into
mainfrom
bb/usb-reconnect-finish-thr_h748zsv2mq

Conversation

@egerev

@egerev egerev commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

An order-event connector can finish after USB loss before its successful foreground run is retained for supervision. Its Entry.handle is 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)

@egerev
egerev marked this pull request as ready for review November 17, 2026 08:41
@egerev egerev added the ship Small-fix rule: orchestrator Diff read at head; merge-keeper may enqueue label Nov 17, 2026
@egerev
egerev enabled auto-merge November 17, 2026 08:41
@egerev
egerev added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit b64130e Nov 17, 2026
56 of 59 checks passed
@egerev
egerev deleted the bb/usb-reconnect-finish-thr_h748zsv2mq branch November 17, 2026 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ship Small-fix rule: orchestrator Diff read at head; merge-keeper may enqueue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant