Python: Prefer explicit AG-UI resume payloads - #6360
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR ensures that explicit resume payload responses take precedence over any responses inferred from incoming messages (e.g., stale function_approvals), and adds a regression test for that behavior.
Changes:
- Add
_merge_workflow_response_sources()to merge resume/message-derived responses with resume taking precedence. - Update
run_workflow_stream()to use the new merge behavior. - Add a test ensuring explicit resume approval responses override stale message approvals.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| python/packages/ag-ui/agent_framework_ag_ui/_workflow_run.py | Merges response sources so explicit resume payloads override message-derived responses. |
| python/packages/ag-ui/tests/ag_ui/test_workflow_run.py | Adds regression test covering precedence of resume interrupts over function_approvals in messages. |
|
@microsoft-github-policy-service agree |
|
Updated the branch against current
The branch is mergeable again from my side. |
|
@gezw is there an open issue we can link this PR to? |
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||
|
@gezw please address the failing typing checks: https://github.com/microsoft/agent-framework/actions/runs/28842620166/job/85543172223?pr=6360#step:4:183 |
|
Please also resolve the conflicted files. Thanks. |
# Conflicts: # python/packages/ag-ui/agent_framework_ag_ui/_workflow_run.py # python/packages/ag-ui/tests/ag_ui/test_workflow_run.py
Summary
Details
run_workflow_stream()can receive resume responses from both the explicitresumepayload and from prior AG-UI messages. When both sources contain an entry for the same pending request id, the explicit resume payload should be treated as the caller's current decision and should not be overwritten by stale message history.This change centralizes the merge behavior so message-derived responses are used as a fallback and explicit resume values win on conflicts.
Validation
From
python/:uv run --group dev pytest -q --disable-warnings packages/ag-ui/tests/ag_ui/test_workflow_run.pyuv run --group dev ruff check packages/ag-ui/agent_framework_ag_ui/_workflow_run.py packages/ag-ui/tests/ag_ui/test_workflow_run.pyuv run --group dev ruff format --check packages/ag-ui/agent_framework_ag_ui/_workflow_run.py packages/ag-ui/tests/ag_ui/test_workflow_run.pyuv run --group dev python -m py_compile packages/ag-ui/agent_framework_ag_ui/_workflow_run.py packages/ag-ui/tests/ag_ui/test_workflow_run.pygit diff --check