Repository navigation
Fail cleanly when sending while disconnected - #282
Merged
Merged
Conversation
A request that is still queued when the radio disconnects, e.g. a reply to a device after startup has failed, called `aps_data_request` on `None` and logged an `AttributeError` traceback. Raise a `DeliveryError` instead, like any other failed send.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #282 +/- ##
=======================================
Coverage 99.15% 99.15%
=======================================
Files 7 7
Lines 945 947 +2
=======================================
+ Hits 937 939 +2
Misses 8 8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
puddly
approved these changes
Oct 28, 2026
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the disconnected-send error-handling change.
No open issues 🎉
What changed in this PR
This PR makes disconnected sends fail with a DeliveryError instead of an AttributeError, allowing existing caller error handling to handle them quietly. It addresses a secondary failure seen after unsuccessful startup, not the underlying endpoint-slot issue.
Changes:
- Check radio connectivity after a send acquires its concurrency slot, covering requests queued before disconnection.
- Add a regression test verifying the error message and absence of pending requests.
| File | Description |
|---|---|
zigpy_deconz/zigbee/application.py |
Raise DeliveryError when the radio is disconnected before sending. |
tests/test_send_receive.py |
Verify disconnected sends fail cleanly without leaving pending requests. |
Review effort: Balanced
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.
Summary
A request sent, or still queued, after the radio disconnected called
aps_data_requestonNone, and the failure was logged as anAttributeErrortraceback. In home-assistant/core#189366 this was an OTA Query Next Image reply sent after the failed startup (#280) had already disconnected.Changes
send_packetchecks for a disconnected radio once it has its turn and raises aDeliveryError, like any other failed send. zigpy's OTA reply task, like other callers usingcreate_catching_task, ignores those quietly.Testing
New test sending with the radio disconnected; on
devit fails with the sameAttributeErroras the report. 146 passed.Related: #280