fix: use type(self) for polymorphic dispatch in CodeExecutorAgent#7437
Open
r266-tech wants to merge 1 commit intomicrosoft:mainfrom
Open
fix: use type(self) for polymorphic dispatch in CodeExecutorAgent#7437r266-tech wants to merge 1 commit intomicrosoft:mainfrom
r266-tech wants to merge 1 commit intomicrosoft:mainfrom
Conversation
Fixes microsoft#7205 The on_messages_stream method called CodeExecutorAgent._reflect_on_code_block_results_flow via the concrete class name, breaking polymorphism for subclasses that override this method. Changed to type(self)._reflect_on_code_block_results_flow to ensure the correct subclass implementation is called, matching the pattern used in AssistantAgent (fix for microsoft#5953).
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.
Fixes #7205
The
on_messages_streammethod inCodeExecutorAgentcalled_reflect_on_code_block_results_flowvia the concrete class nameCodeExecutorAgent._reflect_on_code_block_results_flow(...), breaking polymorphism for subclasses that override this method.Change
Changed line 667 from:
to:
This ensures the correct subclass implementation is called, matching the pattern used in the fix for the similar issue #5953 in
AssistantAgent.Impact
python/packages/autogen-agentchat/src/autogen_agentchat/agents/_code_executor_agent.pyCodeExecutorAgentthat override_reflect_on_code_block_results_flowwill now have their override called correctlyCodeExecutorAgent