Python: Fix GroupChat orchestrator message cleanup issue#3712
Merged
moonbox3 merged 4 commits intomicrosoft:mainfrom Feb 6, 2026
Merged
Python: Fix GroupChat orchestrator message cleanup issue#3712moonbox3 merged 4 commits intomicrosoft:mainfrom
moonbox3 merged 4 commits intomicrosoft:mainfrom
Conversation
Apply clean_conversation_for_handoff to GroupChatOrchestrator and AgentBasedGroupChatOrchestrator _handle_response methods to remove tool-related content that causes API errors from empty messages. Fixes microsoft#3705
…-3705-1770327487 # Conflicts: # python/packages/orchestrations/agent_framework_orchestrations/_group_chat.py
Member
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug where group chat orchestrators fail with API errors due to empty messages when tool-related content is not properly cleaned from the conversation history. The fix applies the existing clean_conversation_for_handoff utility function to remove tool calls, tool responses, and function approval requests before appending messages to the conversation history or broadcasting them to participants.
Changes:
- Import
clean_conversation_for_handofffrom_orchestrator_helpersmodule - Apply message cleaning in
GroupChatOrchestrator._handle_responseafter processing participant responses - Apply the same cleaning in
AgentBasedGroupChatOrchestrator._handle_responsefor consistency
This was referenced Feb 6, 2026
moonbox3
approved these changes
Feb 6, 2026
dmytrostruk
approved these changes
Feb 6, 2026
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.
Apply clean_conversation_for_handoff to GroupChatOrchestrator and AgentBasedGroupChatOrchestrator _handle_response methods to remove tool-related content that causes API errors from empty messages.
Moves remaining orchestration-related files to the orchestrations package (were previously missed in the original PR to move things).
Fixes #3705
Contribution Checklist