Commit 00d5c9e
committed
fix(agentchat_fastapi): handle WebSocket disconnect gracefully in app_team.py
- Add specific WebSocketDisconnect exception handling in _user_input function
- Handle client disconnects during message processing without RuntimeError
- Prevent attempts to send messages to closed WebSocket connections
- Add graceful cleanup when clients disconnect while waiting for input
Fixes #6280: Heavy use of broad Exceptions leads to incorrect error handling
The previous implementation caught WebSocketDisconnect with broad Exception
handlers and re-raised as RuntimeError, preventing graceful disconnect handling.
This fix allows proper exception propagation and clean connection termination.1 parent 867804a commit 00d5c9e
3 files changed
Lines changed: 907 additions & 750 deletions
File tree
- python
- packages/autogen-core/docs/src/user-guide/agentchat-user-guide
- samples/agentchat_fastapi
0 commit comments