Repository navigation
fix(homeassistant): report webhook delivery failures - #60
Merged
Merged
Conversation
Webhook sends discarded every error, so a notification that never arrived looked identical to one that did. The poll then ran normally and timed out with zero failed reads, which pointed at the response helper when the real fault was delivery. Failures now reach the log with the URL and reason, covering non-2xx statuses, timeouts and transport errors. Waiting-state failures add that no notification was delivered, since that is the case where the agent stays blocked with nothing on the phone. A waiting state with no configured URL is reported too, rather than silently doing nothing. Each URL is reported separately, so a working status webhook no longer masks a failing notification webhook. The per-request timeout moves from 2s to 5s. Two seconds is tight for a remote Home Assistant behind TLS, and a timeout meant a silently lost notification. The dispose drain grows to 6s so it cannot cut off a request that is still within its own timeout.
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.
The log points away from the poll
0 failed readsmeans the token and entity are fine — 60 successful reads.0 responses for other requestsmeans the helper held nothing for the full 120s. Combined with "nothing showed up on the phone", nobody ever wrote to it, because there was no notification to tap.The poll is innocent. The remaining blind spot was delivery:
sendWebhookhad a per-URL.catch(() => {}), so a failed notification was indistinguishable from a delivered one.Changes
Webhook failures now reach the log with URL and reason:
waiting webhook to https://ha…/webhook/typo failed: HTTP 404 (no notification was delivered)… failed: HTTP 401 (no notification was delivered)… failed: timed out after 5000ms (no notification was delivered)… failed: Unable to connect. Is the computer able to access the url?no webhook URL configured for the waiting state, so no notification was sentEach URL is reported separately, which matters for this exact topology: with
waitingfanning out to a status URL and a notify URL, a healthy status webhook previously masked a failing notify webhook.Timeout raised 2s → 5s. Two seconds is tight for a remote HA behind TLS, and a timeout meant a silently lost notification. The dispose drain grows 3s → 6s so it cannot truncate a request still inside its own timeout.
Verification
Real opencode process,
waitingfanned out to a working status URL and a 404 notify URL — reproducing the reported signature:Same
0 failed reads/0 responsestimeout as the report, but the cause is now stated.All six webhook failure modes covered in a unit harness. Existing receiver, negative-path, entity-read and config suites still pass.
mise run typecheck,lint,buildall pass.What to check on the work laptop
Once this ships, the log will name the failing URL. Likely candidates: the
opencode_work_agent_notifywebhook id does not match the HA automation trigger, the notify automation is disabled, or delivery exceeded the old 2s timeout.