Repository navigation
fix(transcription): end a stream cleanly when the provider already closed it - #356
Merged
Merged
Conversation
…osed it Deepgram closes an idle stream (NET-0001) after ~10 s without audio. When the session then ended, end_stream sent CloseStream on the dead socket, raised ConnectionClosedError, and never removed the stream entry. It now unregisters the stream first and logs one warning for an already-closed socket instead of raising. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
AnkushMalaker
approved these changes
Nov 16, 2026
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
Deepgram closes an idle stream (NET-0001) after about 10 s with no audio. When the session then ended,
end_streamsentCloseStreamon the dead socket. It raisedConnectionClosedError, logged a traceback, marked transcription completion aserror, and never removed the stream from_streams(one leaked entry per such session).No transcript is lost: finals that arrived before the close were already published.
Fix
end_streampops the stream entry first, so no exit path leaks it.Not in scope
KeepAliveduring audio pauses, so the stream stays open. Not done on purpose.Tests
tests/test_streaming_end_stream_closed.py: fails before the fix (2 failed), passes after, on upstreamdev.tests/test_streaming_clock_offset.py: passes (10 passed together).🤖 Generated with Claude Code