Skip to content

fix: log RST_STREAM/error-code-0 at DEBUG instead of WARNING#7

Merged
eman merged 2 commits into
mainfrom
fix/rst-stream-log-level
May 14, 2026
Merged

fix: log RST_STREAM/error-code-0 at DEBUG instead of WARNING#7
eman merged 2 commits into
mainfrom
fix/rst-stream-log-level

Conversation

@eman
Copy link
Copy Markdown
Owner

@eman eman commented May 14, 2026

Problem

RST_STREAM with error code 0 (HTTP/2 NO_ERROR) is appearing as a WARNING in 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 to DEBUG. All other retryable gRPC errors continue to log at WARNING.

Testing

226 existing tests pass.

eman added 2 commits May 13, 2026 23:05
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
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 for CANCELLED, 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.

@eman eman merged commit 61560ca into main May 14, 2026
9 checks passed
@eman eman deleted the fix/rst-stream-log-level branch May 14, 2026 15:28
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