-
Notifications
You must be signed in to change notification settings - Fork 7.8k
fix:Prevent Async Event Loop from Running Indefinitely #6530
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
jackgerrits
reviewed
May 19, 2025
python/packages/autogen-core/src/autogen_core/_single_threaded_agent_runtime.py
Show resolved
Hide resolved
jackgerrits
approved these changes
May 20, 2025
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6530 +/- ##
==========================================
- Coverage 79.52% 79.52% -0.01%
==========================================
Files 225 225
Lines 16623 16624 +1
==========================================
Hits 13220 13220
- Misses 3403 3404 +1
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:
|
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?
Prevent Async Event Loop from Running Indefinitely
Description
This pull request addresses a bug in the python/packages/autogen-core/src/autogen_core/_single_threaded_agent_runtime.py
async send_messagefunction where messages were being queued for recipients that were not recognized. The current implementation sets an exception on the future object when the recipient is not found, but continues to enqueue the message, potentially leading to inconsistent states.Changes Made
Impact
This fix prevents messages from being sent to unknown recipients. It also ensures that the event loop can terminate correctly without being stuck in an indefinite state.
Testing
Ensure that the function correctly handles cases where the recipient is not recognized by returning the exception without enqueuing the message, and verify that the event loop terminates as expected.
Related issue number
Checks