| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Restore completed responses for workflow-conversation agents while preventing hosted workflow adapters from materializing streamed responses twice. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c2d86826-ead0-40bc-b84b-a513ac4d325f
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c2d86826-ead0-40bc-b84b-a513ac4d325f
There was a problem hiding this comment.
This PR improves streaming response correlation in the .NET workflow stack by (1) generating stable MessageIds for streaming updates that lack them, and (2) avoiding duplicated content when forwarding completion events after content was already streamed.
Changes:
| File | Description |
|---|---|
| dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/WorkflowHostSmokeTests.cs | Updates smoke tests to assert completion events remain observable without duplicating streamed text; adds scenarios around suppression boundaries. |
| dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/AIAgentHostExecutorTests.cs | Adds coverage ensuring the executor assigns one stable MessageId across streaming updates and propagates it to the completed response. |
| dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/ObjectModel/SendActivityExecutorTest.cs | Verifies SendActivityExecutor propagates MessageId/ResponseId consistently into update + response events. |
| dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/ObjectModel/InvokeAzureAgentExecutorTest.cs | Adds tests for autoSend defaulting to true and honoring explicit values for event emission. |
| dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Extensions/AgentProviderExtensionsTest.cs | Adjusts test updates to use ChatResponseUpdate and asserts stable generated MessageId across events/response. |
| dotnet/src/Microsoft.Agents.AI.Workflows/WorkflowSession.cs | Tracks streamed message IDs and avoids duplicating already-streamed message content during completion forwarding. |
| dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/AIAgentHostExecutor.cs | Generates stable MessageId for streaming updates (per response/role) when missing. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/ObjectModel/SendActivityExecutor.cs | Ensures SendActivity emits update + response with consistent MessageId/ResponseId. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/AgentProviderExtensions.cs | Generates stable MessageId for declarative streaming updates when missing. |
Sorry, something went wrong.
There was a problem hiding this comment.
Reviewers: 5 | Confidence: 89% | Result: All clear
Reviewed: Correctness, Security Reliability, Test Coverage, Failure Modes, Design Approach
Automated review by alliscode's agents
Sorry, something went wrong.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c2d86826-ead0-40bc-b84b-a513ac4d325f
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c2d86826-ead0-40bc-b84b-a513ac4d325f
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c2d86826-ead0-40bc-b84b-a513ac4d325f
There was a problem hiding this comment.
dotnet/src/Microsoft.Agents.AI.Workflows/WorkflowSession.cs:569
bool messageWasStreamed =
message.MessageId is { Length: > 0 } completedMessageId
&& streamedMessageIds.Contains((agentResponse.ExecutorId, completedMessageId));
Sorry, something went wrong.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c2d86826-ead0-40bc-b84b-a513ac4d325f
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c2d86826-ead0-40bc-b84b-a513ac4d325f
| Back | FazBrowse Home | New Git URL |
This pull request introduces improvements to how message IDs are assigned and handled for streaming agent responses, ensuring that all related updates share a stable identifier and that completion events do not duplicate content. It also adds and updates tests to verify the correct assignment and propagation of message and response IDs, and corrects the emission of completion events in streaming workflows.
Stable Message ID Assignment and Propagation:
Streaming agent response updates now receive a stable MessageId that is reused for all updates belonging to the same logical message, ensuring consistent identification across updates. This applies both in AgentProviderExtensions.InvokeAgentAsync and AIAgentHostExecutor. [1] [2]
The SendActivityExecutor now assigns both MessageId and ResponseId to messages and updates, and ensures these are correctly propagated through all related events.
Workflow Session and Completion Event Handling:
Test Enhancements and Coverage:
Test Infrastructure and Mocking:
Minor Code Cleanups:
These changes collectively improve the reliability and clarity of agent response streaming, making it easier to track and correlate updates and final responses throughout the workflow system.
Contribution Checklist