Repository navigation
Python: Preserve merge mode in WorkflowAgent streaming - #10331
Open
WhaleTech (ryo-whaletech) wants to merge 1 commit into
Open
WhaleTech (ryo-whaletech) wants to merge 1 commit into
WhaleTech (ryo-whaletech) wants to merge 1 commit into
Conversation
Forward the existing update-level merge_mode when rebuilding executor updates so replacement snapshots discard stale content from finalized responses and session history. Cover merge intent forwarding and text/URI replacement through the public streaming API and in-memory history provider.
WhaleTech (ryo-whaletech)
deployed
to
github-app-auth
November 13, 2026 06:23 — with
GitHub Actions
Active
WhaleTech (ryo-whaletech)
deployed
to
github-app-auth
November 13, 2026 06:23 — with
GitHub Actions
Active
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the change preserving merge modes in streamed workflow updates.
No open issues 🎉
What changed in this PR
This PR fixes #10330 by preserving merge_mode when WorkflowAgent forwards streamed updates, allowing replacement snapshots to remove stale content from final responses and session history.
Changes:
- Forward the existing
merge_modefield without changing public signatures. - Extend metadata-forwarding coverage for
None,append, andreplace. - Add text and URI replacement regressions for stream finalization and history persistence.
| File | Description |
|---|---|
python/packages/core/tests/workflow/test_workflow_agent.py |
Tests merge-mode forwarding and replacement behavior in final responses and history. |
python/packages/core/agent_framework/_workflows/_agent.py |
Preserves incoming merge_mode when reconstructing streamed updates. |
Review effort: Balanced
3 tasks
This branch was successfully deployed
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.
Motivation & Context
WorkflowAgentreconstructs executor-emittedAgentResponseUpdateobjects without copying theirmerge_mode.An authoritative
replacesnapshot therefore becomes an ordinary accumulating update:draftfollowed byfinalwith the same message ID produces
draftfinal. The stale content also reaches session history, and replacementsnapshots containing URI content retain the earlier URI.
The existing content identity contract
already defines update-level replacement. This change preserves that intent through the workflow wrapper.
Description & Review Guide
data.merge_modewhen reconstructing anAgentResponseUpdatein_workflows/_agent.py.None,append, andreplace.get_final_response()andInMemoryHistoryProvider, with text-only and text-plus-URI updates.URI content in the final response and history.
appendintent is preserved.probes still project
draftfinal. This change fixes core forwarding and aggregation, not those converters.merge_modeafter construction, forwardingnow raises the constructor's
ValueErrorinstead of silently dropping that invalid value.stream finalization and history persistence.
On source commits
30285709c1d60736a9b8b8ad87cd4f94a3719f6aand6811ef8c7d83cf2949679f733aa15ac1bf290fe6, the focused checks give 6 failures and 3 passing controls before thefix, then 9 passes after it. The nine checks also pass on Python 3.11 through 3.15.
On the latter commit, using macOS arm64, Python 3.11.14, frozen workspace dependencies, and uv 0.13.7:
poe test -A -n 4gives 21,401 passed, 580 skipped, and 5 xfailed. Core alone gives 9,731 passed. Individual packageruns for A2A, AG-UI, Foundry Hosting, DevUI, declarative, and orchestrations give 4,949 passed in total. Core strict source Pyright and all
five test type checkers pass, as do changed-file Ruff, format, and pre-commit hooks with
poe-checkskipped as in CI.The aggregate run emits 1,498 warnings and shutdown-time OpenTelemetry exporter diagnostics; an unfixed core control
also reproduces the exporter diagnostics. Linux/Windows CI and external-service integration tests were not run locally.
The aggregate command was rerun before publication on main commit
c7e50ccd90370416afc4ab466394b06395f7dccd: 21,401 passed, 580 skipped, 5 xfailed, and 1,491 warnings.The core source and test trees are unchanged from the earlier validation commit.
Related Issue
Fixes #10330
Maintainer agreement on this maintenance candidate has not yet been recorded.
AI Assistance
AI assistance details: Duplicate research, local reproduction, diagnosis, the implementation, regression tests,
and this pull request description.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.