diff --git a/CHANGELOG.md b/CHANGELOG.md index eb3a555..bfbadfc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ ## [Unreleased] +### Fixed +- `RST_STREAM with error code 0` (HTTP/2 `NO_ERROR`, a normal server-side graceful reset) is now logged at `DEBUG` instead of `WARNING` to reduce log noise +- `CANCELLED` (server closed the stream normally, e.g. keepalive timeout or server rotation) is now logged at `INFO` instead of `WARNING` +- `UNAUTHENTICATED` reconnects handled by the automatic token refresh are now logged at `INFO` instead of `WARNING` + ## [0.3.0] - 2026-05-12 ### Added diff --git a/src/quilt_hp/services/streaming.py b/src/quilt_hp/services/streaming.py index d4541e4..7506309 100644 --- a/src/quilt_hp/services/streaming.py +++ b/src/quilt_hp/services/streaming.py @@ -612,7 +612,9 @@ async def _run_stream_with_reconnect(self) -> None: if is_unauth and self._authenticate is not None and can_retry: self._stream_state = "reconnecting" - logger.warning( + # Token expiry is handled automatically — INFO to confirm it + # happened without alarming the user. + logger.info( "Stream got UNAUTHENTICATED; refreshing token (attempt %d)", attempt + 1, ) @@ -630,10 +632,25 @@ async def _run_stream_with_reconnect(self) -> None: break elif can_retry: self._stream_state = "reconnecting" - logger.warning( + details = exc.details() or "" + # Classify the error to pick the right log level: + # DEBUG — HTTP/2 NO_ERROR RST_STREAM: server gracefully + # recycled the connection (load balancer, keepalive). + # INFO — CANCELLED: server closed the stream normally + # (keepalive timeout, server rotation, etc.). + # WARNING — anything else is unexpected. + is_graceful_reset = "RST_STREAM with error code 0" in details + is_server_cancel = exc.code() == grpc.StatusCode.CANCELLED + if is_graceful_reset: + log = logger.debug + elif is_server_cancel: + log = logger.info + else: + log = logger.warning + log( "Stream error %s: %s; reconnecting in %.1fs (attempt %d)", exc.code(), - exc.details(), + details, delay, attempt + 1, )