Skip to content

fix(ancs): a late response no longer consumes the request in flight - #345

Merged
zackb merged 1 commit into
zackb:mainfrom
fernando2393:pr/ancs-late-response
Nov 23, 2026
Merged

zackb merged 1 commit into
zackb:mainfrom
fernando2393:pr/ancs-late-response

Conversation

@fernando2393

Copy link
Copy Markdown
Contributor

Problem

Data Source responses carry no request id, so ControlPointSequencer credits whatever completes to the request in flight. When a GetNotificationAttributes answer turns up after its own request has timed out, it completes the next request instead. The client then discards it on the uid mismatch (discarding a response for uid 86 while 87 was in flight), and notification 87 is lost along with it.

Seen on a real iPhone while the daemon was paging an unreachable BR/EDR link (each attempt holds the shared radio ~30 s): answers arrived ~0.2 s past the 15 s timeout, and each one took the following notification down with it.

Change

A completed GetNotificationAttributes response whose echoed uid is not the request in flight is dropped, and that request keeps waiting for its own answer (the assembler is re-armed for it). Only notification-attribute responses are checked; they are the only ones with a uid to compare.

The existing test that documented the old behaviour (ALateResponseIsDeliveredAgainstTheWrongRequest) now checks the new one (ALateResponseDoesNotConsumeTheRequestInFlight): the stale answer completes nothing, and the in-flight request then completes with its own.

Testing

🤖 Generated with Claude Code

Data Source responses carry no request id; the sequencer credited whatever
completed to the request in flight. When a GetNotificationAttributes answer
turned up after its own request had timed out, it completed the next request
instead: the client then discarded it on the uid mismatch ("discarding a
response for uid N while N+1 was in flight"), and the next notification was
lost along with it.

Seen on a real iPhone while the daemon was paging an unreachable BR/EDR link
(each attempt ~30 s on the shared radio): answers arrived just past the 15 s
timeout and every second notification vanished.

A completed GetNotificationAttributes response whose echoed uid is not the one
in flight is now dropped, and the request in flight keeps waiting for its own
answer. The existing test that documented the old behaviour now checks this.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@zackb
zackb merged commit bf1a6a9 into zackb:main Nov 23, 2026
7 checks passed
@fernando2393
fernando2393 deleted the pr/ancs-late-response branch November 23, 2026 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants