[dotnet-port-fixes] Prefer terminal workflow outputs in collected responses - #583
Conversation
…ponses Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR aligns Go’s workflow-as-agent “collected” response behavior with the upstream .NET fix so that non-streaming Collect() prefers designated terminal workflow outputs over intermediate hosted-agent update outputs when both occur in the same run. The change is kept internal to workflow/agentworkflow and is covered by a new regression test.
Changes:
- Track terminal workflow output-derived updates separately during collection and use them for the final merged response when present.
- Preserve existing streaming behavior (streaming continues to surface both hosted updates and workflow output translations).
- Add/adjust tests to validate the new selection behavior and streaming visibility expectations.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| workflow/agentworkflow/message_merger.go | Adds collectedResponseMergeState to maintain both “all updates” and “terminal output only” merge paths for collection. |
| workflow/agentworkflow/workflow.go | Detects terminal workflow outputs and routes collected merge selection to prefer terminal workflow output updates. |
| workflow/agentworkflow/workflow_test.go | Updates streaming assertion and adds a regression test ensuring Collect() prefers terminal workflow output over intermediate hosted-agent updates. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Cross-Repo Parity Review — No Issues FoundScope: This PR is a direct port of the upstream .NET fix (microsoft/agent-framework#6212 / commit Key observations:
No parity issues identified. ✅
|
Summary
Aligned workflow-as-agent collection with the upstream .NET fix from microsoft/agent-framework#6212 so non-streaming
Collect()responses now prefer designated terminal workflow outputs over intermediate hosted-agent updates when both are present. The Go change stays internal toworkflow/agentworkflow: it tracks terminal output-derived updates separately during collection, preserves existing streaming behavior, and adds a regression test covering intermediate hosted-agent outputs followed by a designated terminal workflow output.Upstream references:
Ported .NET PRs
Breaking Changes
No.
Tests and Examples
go test ./workflow/agentworkflowTestNew_CollectPrefersTerminalWorkflowOutputOverIntermediateHostedAgentUpdatesTestNew_IncludeOutputsInResponseto assert streaming visibility while collected responses prefer terminal workflow outputsNotes
IncludeOutputsInResponsecontract for generic workflow outputs; it only realigns final collected response selection.Closes #563