Python: Execute every approved tool in a parallel AG-UI HITL batch - #7692
Closed
Ahmed Hassan (AAH20) wants to merge 4 commits into
Closed
Python: Execute every approved tool in a parallel AG-UI HITL batch#7692Ahmed Hassan (AAH20) wants to merge 4 commits into
Ahmed Hassan (AAH20) wants to merge 4 commits into
Conversation
AG-UI resume synthesizes one user message per interrupt, and the sanitizer treated leftover always_require siblings as abandoned follow-up. Co-authored-by: Cursor <cursoragent@cursor.com>
Ahmed Hassan (AAH20)
requested review from
SergeyMenshykh,
Tao Chen (TaoChenOSU),
chetantoshniwal,
Eduard van Valkenburg (eavanvalkenburg),
Giles Odigwe (giles17),
Evan Mattson (moonbox3),
Peter Ibekwe (peibekwe),
Roger Barreto (rogerbarreto) and
westey (westey-m)
as code owners
August 17, 2026 12:17
Ahmed Hassan (AAH20)
temporarily deployed
to
github-app-auth
August 17, 2026 12:17 — with
GitHub Actions
Inactive
Ahmed Hassan (AAH20)
temporarily deployed
to
github-app-auth
August 17, 2026 12:17 — with
GitHub Actions
Inactive
Ahmed Hassan (AAH20)
temporarily deployed
to
github-app-auth
August 17, 2026 12:17 — with
GitHub Actions
Inactive
Ahmed Hassan (AAH20)
temporarily deployed
to
github-app-auth
August 17, 2026 12:24 — with
GitHub Actions
Inactive
Contributor
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||
Evan Mattson (moonbox3)
left a comment
Contributor
There was a problem hiding this comment.
Thanks for working on this. Please also have a look at the failing CI/CD checks.
Evan Mattson (moonbox3)
temporarily deployed
to
github-app-auth
August 17, 2026 23:34 — with
GitHub Actions
Inactive
Contributor
|
Looks like CI/CD is okay now after a merge from main. |
Dedup identity now includes the decision and canonical payload so a later reject or argument edit is not collapsed before occurrence-aware matching. Co-authored-by: Cursor <cursoragent@cursor.com>
Ahmed Hassan (AAH20)
temporarily deployed
to
github-app-auth
August 18, 2026 06:04 — with
GitHub Actions
Inactive
Contributor
|
/review |
Contributor
|
Ahmed Hassan (@AAH20) there's no need to update the 004-python-function-call-loop.md doc. We can revert the change, please. |
Contributor
|
Please re-open when ready to address the feedback / remaining file conflict. |
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
AG-UI HITL resume currently executes only the first approved tool in a parallel
always_requirebatch. CopilotKit and other AG-UI clients synthesize one user message per interrupt, so the second (and later) approval-control messages look like a new user turn. History sanitization then injects a synthetic"Tool execution skipped - user provided follow-up message"result for leftover gated siblings, and ID-less dedup can collapse distinct approval-control messages that hash the samestr(Content).This fixes the silently dropped calls so a complete resume for a parallel gated batch executes every accepted tool once. Rejected siblings still do not execute. Real follow-up user text still skips leftover pending calls. Queued one-at-a-time
ToolApprovalMiddlewarebehavior and never-require mixed-batch siblings are unchanged.Description & Review Guide
_sanitize_tool_historyno longer treats consecutive approval-control user messages as follow-up that abandons leftover gatedcall_ids._deduplicate_messageskeys ID-less approval-control messages by(approval_id, call_id)instead of hashingstr(Content)._resolve_approval_responseswithout skip injection._local_approval_content_ids_to_remove; calling_resolve_approval_responsesdirectly with unsanitized responses already executes both calls, so this change stays in adapters rather than the occurrence matcher.ToolApprovalMiddlewareone-at-a-time surfacing and never-require sibling release still pass.There is no other open PR for this issue.
This area is marked as function-calling-loop core-team ownership in
python/AGENTS.md. The spec matrix row and extra AG-UI validation commands required by that document are included in the change.Related Issue
Fixes #7569
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.If this parallel HITL drop is showing up in a live agent deployment, A2Z SOC’s Instant Audit ($499) and consultation are available for production agent-action gating reviews.
Made with Cursor