Skip to content

Python: fix(ag-ui): persist workflow HITL user text in thread snapshots - #8273

Open
LI (ktz03) wants to merge 5 commits into
microsoft:mainfrom
ktz03:fix/ag-ui-workflow-hitl-snapshot
Open

LI (ktz03) wants to merge 5 commits into
microsoft:mainfrom
ktz03:fix/ag-ui-workflow-hitl-snapshot

Conversation

@ktz03

@ktz03 LI (ktz03) commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Motivation & Context

AG-UI workflow HITL resumes often put the user reply in resume.interrupts[].value with messages: []. Without projecting that text into the Thread Snapshot, hydrate loses the conversational turn after resume (#8160).

Description & Review Guide

  • What are the major changes? Project user-visible resume values into snapshot messages; skip approval gates via pending request type/data (not response text); hashable multimodal identity; count-aware role/content dedupe when IDs differ; admit only user turns from resume payloads.
  • What is the impact of these changes? HITL replies persist across hydrate; forged assistant/system/tool roles cannot enter backend-owned history; conversational request_info(str) answers like "approved" are no longer dropped.
  • What do you want reviewers to focus on? _snapshot_messages_from_resume_value / _append_unique_snapshot_messages in agent_framework_ag_ui/_workflow.py and the unit tests in test_workflow_agent.py.

Related Issue

Fixes #8160

No other open PR targets this issue.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR is linked to an issue and there is no other open PR for this issue (see Related Issue above).
  • This is not a breaking change. If it is a breaking change, add the breaking change label (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.

When resume carries user replies only in interrupt.value with messages:[], seed the snapshot builder with those turns so hydrate keeps them (microsoft#8160).

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.

🟡 Changes recommended

Resume synthesis can persist approval strings and duplicate user turns.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Persists workflow HITL resume text in AG-UI thread snapshots for correct hydration.

Changes:

  • Converts conversational resume values into snapshot messages.
  • Adds regression coverage for message-list resumes.
File summaries
File Description
_workflow.py Adds resume-value snapshot synthesis.
test_workflow_agent.py Tests HITL text persistence.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 2
  • Review effort level: Balanced

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread python/packages/ag-ui/agent_framework_ag_ui/_workflow.py Outdated
Comment thread python/packages/ag-ui/agent_framework_ag_ui/_workflow.py Outdated
@ktz03

Copy link
Copy Markdown
Contributor Author

Fork CI for this PR may need a maintainer to Approve workflows before Python tests run (same as other community PRs). Happy to address review feedback once checks appear.

Address Copilot review on microsoft#8273: do not hydrate bare approved/rejected resume strings as user messages, and avoid duplicating turns already present in request messages.
@ktz03
LI (ktz03) deployed to github-app-auth September 11, 2026 05:10 — with GitHub Actions Active
@ktz03

Copy link
Copy Markdown
Contributor Author

Follow-up for Copilot review: skip bare approval/rejection resume strings as user turns, and dedupe resume-synthesized snapshot messages against incoming messages. See b04c2ea.

@FOWEPJF255

Copy link
Copy Markdown
Contributor

Checks look good. Persisting the HITL user text from resume.interrupts[].value into the Thread Snapshot closes a real hydrate gap for workflow AG-UI resumes with empty messages.

If anything is still blocking review on #8160, happy to dig in.

Comment thread python/packages/ag-ui/agent_framework_ag_ui/_workflow.py Outdated
Comment thread python/packages/ag-ui/agent_framework_ag_ui/_workflow.py
Comment thread python/packages/ag-ui/agent_framework_ag_ui/_workflow.py
Comment thread python/packages/ag-ui/agent_framework_ag_ui/_workflow.py Outdated
- Hashable multimodal content identity for resume dedupe
- Project only user turns from resume payloads
- Skip approvals via pending request type/data, not response text
- Count-aware role/content fallback when message IDs differ
- Hashable multimodal content identity for resume dedupe
- Project only user turns from resume payloads
- Skip approvals via pending request type/data, not response text
- Count-aware role/content fallback when message IDs differ
@ktz03
LI (ktz03) deployed to github-app-auth September 14, 2026 12:35 — with GitHub Actions Active
@eavanvalkenburg

Copy link
Copy Markdown
Member

Thanks for the update. Before this is ready, could you please:

  • replace the PR body with the current repository template, retain its four required sections, provide substantive Motivation and Description answers, and complete the applicable checklist items

Once those are addressed, please re-request review. Thanks!

@ktz03
LI (ktz03) deployed to github-app-auth September 14, 2026 13:52 — with GitHub Actions Active
@ktz03

Copy link
Copy Markdown
Contributor Author

Eduard van Valkenburg (@eavanvalkenburg) Updated PR body to the repository template and addressed the latest review feedback on this head — please re-review when convenient.

@eavanvalkenburg

Copy link
Copy Markdown
Member

Thanks for updating the PR body. The remaining blocker is that this branch now conflicts with main. Could you please resolve the merge conflicts and update the PR? Once that is done, the approval-gated workflows can be run and the PR can be reviewed.

Replay conversational HITL resume turns into the thread snapshot while preserving main's reasoning capture and overlap-merge resume path.
@ktz03
LI (ktz03) deployed to github-app-auth September 15, 2026 08:36 — with GitHub Actions Active
@ktz03

Copy link
Copy Markdown
Contributor Author

Addressed on 8120028f: merged main and resolved the HITL snapshot / resume conflicts while keeping the conversational HITL user-text persistence on the current snapshot builder.

Workflow runs for this head are currently waiting on approval-gated Actions.

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.

Python: [Bug]: AG-UI workflow resume does not persist user HITL text into Thread Snapshot

5 participants