Repository navigation
fix(inference): log retryable STT recv errors at debug - #7918
Open
muntazir868 wants to merge 1 commit into
Open
muntazir868 wants to merge 1 commit into
muntazir868 wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Devin Review found 1 new potential issue.
2 flags not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)
muntazir868
force-pushed
the
fix/7441-retryable-stt-debug-log
branch
from
November 14, 2026 13:01
c7a8c5d to
ddd7675
Compare
Retryable gateway errors (e.g. provider refusing session during init, code 2006) are already reported by SpeechStream's retry loop (WARNING) and the session recreates the stream once retries are exhausted. Logging that same failure as ERROR double-logs handled retries and triggers false failure alerts on recovered sessions. Changes: - recv_task: wrap in try/except, log retryable APIErrors at DEBUG level - error message handler: use DEBUG for retryable errors, ERROR for terminal ones
muntazir868
force-pushed
the
fix/7441-retryable-stt-debug-log
branch
from
November 21, 2026 18:56
ddd7675 to
ad23fd9
Compare
This branch has not been deployed
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.
Split out of #7502 to keep that PR focused on the RoomIO change.
Problem
When the gateway rejects a streaming STT session before input ends — for example a provider refusing the session during init,
code=2006"Streaming ASR unavailable" — the failure isretryable=True.SpeechStream's retry loop already reports that failure at WARNING and recreates the stream while retries remain, but the failure was also logged twice at ERROR from inside the stream:recv_tasklogged"received error from LiveKit Inference STT"at ERROR for everyerrormessage, retryable or not.recv_taskwas wrapped inutils.log_exceptions, which logged the propagated exception at ERROR a second time.Net effect: a gateway-level reject that the framework fully recovered from still produced ERROR-level logs and tripped failure alerts, blaming the application for a handled retry.
Change
Receiver failures are now level-aware and emitted once:
errorevent is converted to anAPIErrorwithout an additional duplicate ERROR logErrors that actually end the session remain visible at ERROR without double-reporting.
Testing
uv run pytest tests/test_inference_stt.py -q(175 passed)uv run --group typing mypy --untyped-calls-exclude=smithy_aws_core --platform linux -p livekit.agents(238 source files, no issues)uv run ruff format --check livekit-agents/livekit/agents/inference/stt.py tests/test_inference_stt.pyuv run ruff check livekit-agents/livekit/agents/inference/stt.py tests/test_inference_stt.pyupstream/main(d78f39990)Closes the logging half of #7441.