Fix/broad exception handling #6280#6647
Merged
ekzhu merged 18 commits intoJun 27, 2025
Merged
Conversation
…on guide- Fix version format from 0.4.0-dev-1 to 0.4.0-dev.1 for all packages- Remove reference to non-existent Microsoft.AutoGen.Extensions package- Add correct extension packages: Aspire, MEAI, and SemanticKernel- Fix typo: RuntimeGatewway -> RuntimeGateway- Improve documentation structure with clear section headersFixes #6244
Fix issue #6277 where TextMessage was used but not imported in three code cells of the custom agents documentation, causing NameError when users run the examples. Changes: - Add TextMessage to imports in ArithmeticAgent section - Add TextMessage to imports in GeminiAssistantAgent section - Add TextMessage to imports in Declarative GeminiAssistantAgent section The CountDownAgent section already had the correct import. Fixes #6277
…_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.
…stallation guide- Fix version format from 0.4.0-dev-1 to 0.4.0-dev.1 for all packages- Remove reference to non-existent Microsoft.AutoGen.Extensions package- Add correct extension packages: Aspire, MEAI, and SemanticKernel- Fix typo: RuntimeGatewway -> RuntimeGateway- Improve documentation structure with clear section headersFixes #6244" This reverts commit 6d9fb2e.
ekzhu
approved these changes
Jun 26, 2025
ekzhu
suggested changes
Jun 26, 2025
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6647 +/- ##
==========================================
- Coverage 79.74% 73.79% -5.96%
==========================================
Files 232 122 -110
Lines 17403 10368 -7035
==========================================
- Hits 13878 7651 -6227
+ Misses 3525 2717 -808
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ekzhu
approved these changes
Jun 27, 2025
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.
Why are these changes needed?
This fix addresses proper WebSocket disconnect handling in the team chat application. The current implementation catches
WebSocketDisconnectexceptions with broadexcept Exception:blocks and re-raises them asRuntimeError, preventing graceful handling of client disconnections. This causes server errors when clients disconnect normally and breaks the expected flow whenUserProxyAgentis waiting for input.Related issue number
Closes #6280
What changes are included in this PR?
Changes Made
Added specific
WebSocketDisconnecthandling in_user_inputfunction:WebSocketDisconnectspecifically and allows it to propagate instead of masking it with broad exception handlingAdded specific
WebSocketDisconnecthandling in main message processing loop:Improved error message handling with disconnect detection:
Checks