Skip to content

Python: Prefer explicit AG-UI resume payloads - #6360

Merged
moonbox3 merged 5 commits into
microsoft:mainfrom
gezw:codex/gezw-agui-resume-message-precedence
Jul 8, 2026
Merged

Python: Prefer explicit AG-UI resume payloads#6360
moonbox3 merged 5 commits into
microsoft:mainfrom
gezw:codex/gezw-agui-resume-message-precedence

Conversation

@gezw

@gezw gezw commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • make explicit AG-UI resume payloads take precedence over message-derived responses
  • preserve message-derived responses when no explicit resume payload is present
  • add workflow-run regression coverage for stale message approvals

Details

run_workflow_stream() can receive resume responses from both the explicit resume payload 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.py
  • uv run --group dev ruff check packages/ag-ui/agent_framework_ag_ui/_workflow_run.py packages/ag-ui/tests/ag_ui/test_workflow_run.py
  • uv 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.py
  • uv 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.py
  • git diff --check

Copilot AI review requested due to automatic review settings June 5, 2026 14:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread python/packages/ag-ui/tests/ag_ui/test_workflow_run.py Outdated
Comment thread python/packages/ag-ui/tests/ag_ui/test_workflow_run.py Outdated
@moonbox3 moonbox3 added the python Usage: [Issues, PRs], Target: Python label Jun 5, 2026
@gezw

gezw commented Jun 6, 2026

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

@gezw

gezw commented Jun 15, 2026

Copy link
Copy Markdown
Contributor Author

Updated the branch against current main and resolved the two outdated Copilot threads. I also re-ran the focused AG-UI workflow checks on the updated tree:

  • uv run --group dev pytest -q --disable-warnings packages/ag-ui/tests/ag_ui/test_workflow_run.py
  • uv run --group dev ruff check packages/ag-ui/agent_framework_ag_ui/_workflow_run.py packages/ag-ui/tests/ag_ui/test_workflow_run.py
  • uv 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.py
  • uv 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.py
  • git diff --check

The branch is mergeable again from my side.

@moonbox3

moonbox3 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

@gezw is there an open issue we can link this PR to?

@gezw
gezw temporarily deployed to integration July 7, 2026 04:37 — with GitHub Actions Inactive
@gezw
gezw temporarily deployed to integration July 7, 2026 04:37 — with GitHub Actions Inactive
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/ag-ui/agent_framework_ag_ui
   _workflow_run.py6657688%74, 88, 90, 92, 95, 222–225, 274, 285, 290, 315, 351–354, 382, 387, 415, 425, 436, 441, 444, 457, 467, 470, 475, 478, 493–495, 500, 502–503, 507, 509, 526, 532–533, 543–544, 548–549, 573–574, 607, 615, 656, 676, 684, 687, 692, 707, 803–817, 849–850, 871–872, 943, 983, 1002
TOTAL44959540087% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
8876 33 💤 0 ❌ 0 🔥 1m 56s ⏱️

@moonbox3

moonbox3 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

@moonbox3

moonbox3 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

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
@moonbox3
moonbox3 enabled auto-merge July 8, 2026 23:03
@moonbox3
moonbox3 added this pull request to the merge queue Jul 8, 2026
Merged via the queue into microsoft:main with commit ab90300 Jul 8, 2026
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants