Skip to content

Fix Conversational AI audio chunk handling and WebSocket error recovery#727

Open
18-RAJAT wants to merge 1 commit intoelevenlabs:mainfrom
18-RAJAT:fix/conversational-ai-audio-chunk-handling
Open

Fix Conversational AI audio chunk handling and WebSocket error recovery#727
18-RAJAT wants to merge 1 commit intoelevenlabs:mainfrom
18-RAJAT:fix/conversational-ai-audio-chunk-handling

Conversation

@18-RAJAT
Copy link

@18-RAJAT 18-RAJAT commented Feb 3, 2026

  • Add audio chunk queue/buffer to prevent loss during transient WebSocket failures
  • Improve error handling to distinguish between fatal and recoverable errors
  • Add connection state checking before sending audio chunks
  • Add proper exception handling for WebSocket errors (including 1011 internal error)
  • Use dedicated thread/task for sending audio chunks to prevent blocking
  • Handle ConnectionClosedOK, ConnectionClosedError, and ConnectionClosed exceptions gracefully
  • Prevent session termination on transient errors to improve reliability

- Add audio chunk queue/buffer to prevent loss during transient WebSocket failures
- Improve error handling to distinguish between fatal and recoverable errors
- Add connection state checking before sending audio chunks
- Add proper exception handling for WebSocket errors (including 1011 internal error)
- Use dedicated thread/task for sending audio chunks to prevent blocking
- Handle ConnectionClosedOK, ConnectionClosedError, and ConnectionClosed exceptions gracefully
- Prevent session termination on transient errors to improve reliability
@kraenhansen
Copy link

First off - thanks a lot for your interest in the project!

This PR addresses a bit too many issues at once for us to reliably review and merge - especially since this is your first PR to our projects. Could I get you to separate this out into:

  • an initial PR with the refactoring (no new features or actual bug-fixes),
  • then PRs for each bug that you're fixing
  • and finally a PR for the audio chunck queue / buffering.

This will make it easier for us to review and potentially partially revert if this (against expectations) introduce new bugs.

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