Conversation
waitForReply dropped the waiter after EXPECT_RESPONSE_AFTER and logged a warning, but never settled the Promise. Hung Home Assistant calls (climate, ADB, etc.) could then block callers forever. Reject with MISSING_REPLY, and reject RESULT_ERROR replies the same way instead of leaving those pending too. Co-authored-by: Cursor <cursoragent@cursor.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #254 +/- ##
==========================================
+ Coverage 81.79% 82.15% +0.35%
==========================================
Files 47 47
Lines 1774 1776 +2
Branches 197 207 +10
==========================================
+ Hits 1451 1459 +8
+ Misses 322 315 -7
- Partials 1 2 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Member
|
LGTM, thanks for the PR! |
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
sendMessagewaits on a Promise whose resolve is stored inwaitingCallback.EXPECT_RESPONSE_AFTER(default 5s),waitForReplydeleted that waiter and logged a warning, but never settled the Promise. Callers (hass.call, entity service methods, registry ops) hung forever.{ type: "result", error: ... }replies:onMessageResultlogged and returned without calling the waiter.This showed up in production as a hung
climate.set_preset_modeleaving an automation stuck overnight. The warning was in the logs; the Promise was still pending.Behavior change
InternalErrorcodeMISSING_REPLY.InternalErrorcodeRESULT_ERROR.EXPECT_RESPONSE_AFTER(seconds).Callers that currently fire-and-forget
hass.call/sendMessagewithout.catch()will start seeing unhandled rejections instead of silent hangs. That is the correct default.Test plan
yarn vitest run src/testing/websocket.spec.mts— resolve on result, reject on timeout, reject on error resultEXPECT_RESPONSE_AFTERinstead of blocking