Skip to content

fix: handle unknown websocket control messages#2147

Merged
dipexplorer merged 1 commit into
RatLoopz:mainfrom
ash1shkumar:fix/asr-session-unboundlocalerror
Jun 20, 2026
Merged

fix: handle unknown websocket control messages#2147
dipexplorer merged 1 commit into
RatLoopz:mainfrom
ash1shkumar:fix/asr-session-unboundlocalerror

Conversation

@ash1shkumar

Copy link
Copy Markdown
Contributor

🛑 STOP: Assignment & File Scope Check

  • I am assigned to this issue.
  • I verified that this PR ONLY touches the required files.

Warning

PRs with unrelated files will not be reviewed and may be closed.

📋 PR Summary & Link

  • **Closes [Bug/UnboundLocalError] Potential UnboundLocalError under ASR WebSocket connection errors #2097 **
  • Summary:
    • Fixed a WebSocket edge case in apps/ml/routers/asr.py.
    • Added handling for unsupported control message types during streaming transcription.
    • The endpoint now returns a structured error response and closes the connection gracefully instead of leaving the session open.
    • Prevents unexpected client messages from causing undefined behavior in the streaming ASR flow.

📸 Proof of Work (Screenshots / Logs)

Backend change (no UI changes).

Manual Verification

  • Started WebSocket streaming session successfully.
  • Sent valid "start" message → received "ready" response.
  • Sent valid "stop" message → received "final" response and connection closed normally.
  • Sent unsupported control message type → received:
{
  "type": "error",
  "error": "Unknown control message type."
}
  • Connection closed with code 1003 as expected.

🏷️ PR Type

  • 🐛 type: bug
  • type: feature
  • 📖 type: docs
  • 🧪 type: testing
  • 🔒 type: security
  • type: performance
  • 🎨 type: design
  • ♻️ type: refactor
  • 🛠️ type: devops
  • type: accessibility

✅ Checklist

  • My PR has a linked issue (Closes #2097 )
  • I have pulled the latest main and resolved any conflicts

@github-project-automation github-project-automation Bot moved this to 📥 Backlog in SahiDawa Workflow Jun 20, 2026
@github-actions github-actions Bot added gssoc:approved Approved for gssoc level:beginner 20 pts status: open-for-all type:bug Something isn't working labels Jun 20, 2026
@dipexplorer dipexplorer merged commit 23d2bdf into RatLoopz:main Jun 20, 2026
13 of 14 checks passed
@github-project-automation github-project-automation Bot moved this from 📥 Backlog to 🎉 Merged in SahiDawa Workflow Jun 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🎉 Congratulations @ash1shkumar! Your Pull Request "fix: handle unknown websocket control messages" has been successfully merged by @dipexplorer.

Thank you for your valuable contribution to SahiDawa! 🇮🇳
If this was for GSSoC 2026, your work is officially merged and valid. Keep up the great work and feel free to claim other open issues. 🚀

Follow us on LinkedIn: https://www.linkedin.com/company/ratloopz/ to get shoutout

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved Approved for gssoc level:beginner 20 pts status: open-for-all type:bug Something isn't working

Projects

Status: 🎉 Merged

Development

Successfully merging this pull request may close these issues.

[Bug/UnboundLocalError] Potential UnboundLocalError under ASR WebSocket connection errors

2 participants