- 
                Notifications
    
You must be signed in to change notification settings  - Fork 657
 
.NET: fix: MessageMerger crashes when there are no dangling messages #660
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a crash in MessageMerger when there are no dangling message updates by adding proper null/empty checks before attempting to process dangling updates.
- Added guard condition to prevent processing empty dangling updates in 
ComputeFlattened() - Enhanced 
ComputeMerged()method with better response merging logic and property handling - Added comprehensive test coverage for MessageMerger functionality
 
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description | 
|---|---|
| MessageMerger.cs | Added null safety checks for dangling updates and improved response merging logic | 
| MessageMergerTests.cs | Added new test file with unit tests for MessageMerger functionality | 
| ChatMessageBuilder.cs | Added helper utilities for creating test data and message streaming | 
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
        
          
                dotnet/tests/Microsoft.Agents.Workflows.UnitTests/MessageMergerTests.cs
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                dotnet/tests/Microsoft.Agents.Workflows.UnitTests/MessageMergerTests.cs
              
                Outdated
          
            Show resolved
            Hide resolved
        
      If the parent "agent" instance received an Id or Name when being instantiated, we should avoid stomping over it with the subagents' ids. But if there is no parent identifier, and only a single subagent yielded identified messages, pull that in.
b6ec9da    to
    e6b2ed3      
    Compare
  
    …icrosoft#660) * fix: MessageMerger crashes when there are no dangling messages * refactor: Better logic for AgentId in Workflow-as-Agent If the parent "agent" instance received an Id or Name when being instantiated, we should avoid stomping over it with the subagents' ids. But if there is no parent identifier, and only a single subagent yielded identified messages, pull that in.
Description
Fixes a crash in MessageMerger when there are no dangling updates.
Contribution Checklist