fix: log RST_STREAM/error-code-0 at DEBUG instead of WARNING#7
Merged
Conversation
HTTP/2 RST_STREAM with error code 0 (NO_ERROR) is a normal server-side graceful reset — e.g. a load balancer recycling the connection — not a real error. Logging it at WARNING pollutes HA logs with spurious noise on every periodic reconnect. Detect this case via the error details string and downgrade to DEBUG. All other retryable gRPC errors continue to log at WARNING.
…ING to INFO CANCELLED (server closed the stream normally, e.g. keepalive timeout or server-side rotation) and UNAUTHENTICATED (handled automatically by the token-refresh callback) are both expected, self-healing events that should not appear as warnings in the HA log. Log levels for stream reconnection events: DEBUG — RST_STREAM with error code 0 (HTTP/2 NO_ERROR graceful reset) INFO — CANCELLED (server-side stream lifecycle) INFO — UNAUTHENTICATED (auto token refresh) WARNING — any other unexpected error code
There was a problem hiding this comment.
Pull request overview
Reduces log noise from the gRPC streaming reconnect loop by downgrading the log level for expected, recoverable conditions (graceful HTTP/2 RST_STREAM resets, server-initiated CANCELLED, and automatic UNAUTHENTICATED token refreshes), while keeping unexpected errors at WARNING.
Changes:
- Downgrade UNAUTHENTICATED reconnect log from WARNING to INFO in
_run_stream_with_reconnect. - Classify retryable stream errors: DEBUG for
RST_STREAM with error code 0, INFO forCANCELLED, WARNING otherwise. - Document the behavior change in CHANGELOG under Unreleased → Fixed.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/quilt_hp/services/streaming.py | Adjusts log levels in the stream reconnect loop based on error classification. |
| CHANGELOG.md | Adds Unreleased Fixed entries describing the new log-level behavior. |
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.
Problem
RST_STREAM with error code 0(HTTP/2NO_ERROR) is appearing as aWARNINGin Home Assistant logs every time the server gracefully resets the gRPC stream (e.g. load balancer connection recycling). This is normal, expected behaviour — the client reconnects immediately — but the warning level causes unnecessary log noise.Change
In
_run_stream_with_reconnect, detect when the error details contain"RST_STREAM with error code 0"and downgrade the log toDEBUG. All other retryable gRPC errors continue to log atWARNING.Testing
226 existing tests pass.