Skip to content

fix(deepgram): recover streaming sessions from unexpected websocket closes#109

Merged
joewongjc merged 5 commits intojoewongjc:mainfrom
IM594:luke/deepgram-streaming-recovery
Apr 13, 2026
Merged

fix(deepgram): recover streaming sessions from unexpected websocket closes#109
joewongjc merged 5 commits intojoewongjc:mainfrom
IM594:luke/deepgram-streaming-recovery

Conversation

@IM594
Copy link
Copy Markdown
Contributor

@IM594 IM594 commented Apr 7, 2026

Summary

This PR improves Deepgram streaming recovery when the websocket closes unexpectedly after the handshake has already succeeded.

Changes

  • add coverage for unexpected Deepgram websocket closes after handshake
  • surface post-handshake abnormal close codes as ASR errors instead of silently treating them as normal completion
  • track streaming ASR errors in RecognitionSession
  • trigger batch fallback when streaming fails because of websocket close or other streaming errors
  • clean up redundant awaits and an unused weak capture in the session pipeline

Why

Previously, if Deepgram closed the websocket unexpectedly after the session was already open, the client could treat that as a normal completion path. In that case, RecognitionSession might skip batch fallback and leave the user with partial or missing text.

Validation

  • swift test --filter 'Deepgram|RecognitionSessionTests'
  • real Deepgram smoke test for connect/end flow
  • real Deepgram smoke test for transcript output using generated speech audio

@IM594 IM594 force-pushed the luke/deepgram-streaming-recovery branch from a13775c to a563390 Compare April 7, 2026 08:48
@IM594 IM594 marked this pull request as ready for review April 7, 2026 08:49
@joewongjc joewongjc merged commit 4445485 into joewongjc:main Apr 13, 2026
@joewongjc
Copy link
Copy Markdown
Owner

Merged manually into main with conflict resolution. Thanks @IM594! 🎉

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