fix: add missing task_done() calls in agent runtime and other issues#7642
Open
Ricardo-M-L wants to merge 1 commit intomicrosoft:mainfrom
Open
fix: add missing task_done() calls in agent runtime and other issues#7642Ricardo-M-L wants to merge 1 commit intomicrosoft:mainfrom
Ricardo-M-L wants to merge 1 commit intomicrosoft:mainfrom
Conversation
- task_done() was missing before early returns in _process_next() when intervention handlers raise exceptions or return DropMessage, causing queue deadlock in SingleThreadedAgentRuntime - Add safety check before remove() in group chat manager to avoid ValueError - Only strip FunctionExecutionResultMessage when trimming actually occurred Fixes: potential queue hang in intervention handler paths Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Contributor
|
@Ricardo-M-L please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
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.
Summary
Three bug fixes in the autogen-core runtime:
1. Critical: Missing
task_done()calls causing queue deadlockFile:
python/packages/autogen-core/src/autogen_core/_single_threaded_agent_runtime.pyIn
_process_next(), when intervention handlers raise exceptions or returnDropMessage, the code returns early without callingself._message_queue.task_done(). This causes the internal counter to become imbalanced, leading to queue hangs wherejoin()blocks forever.Fixed all 6 early-return paths in the Send, Publish, and Response envelope handlers.
2. Medium: Unchecked
list.remove()in group chat managerFile:
python/packages/autogen-agentchat/src/autogen_agentchat/teams/_group_chat/_base_group_chat_manager.pyself._active_speakers.remove(message.name)raisesValueErrorif the speaker is not in the list. Added a safety check.3. Medium: Over-eager message removal in token-limited context
File:
python/packages/autogen-core/src/autogen_core/model_context/_token_limited_chat_completion_context.pyThe code unconditionally removed the first
FunctionExecutionResultMessageeven when no trimming occurred. Function execution results are critical for tool-use flows — only strip them when trimming actually happened.Test plan
pnpm test/pyteston modified packages (deps not installed locally — verified by type inspection)task_done(), lock check added,trimmedflag added