Python: Correlate AG-UI confirm_changes snapshots by call id - #7411
Merged
eavanvalkenburg merged 3 commits intoJul 30, 2026
Merged
Conversation
eavanvalkenburg
temporarily deployed
to
github-app-auth
July 29, 2026 20:11 — with
GitHub Actions
Inactive
eavanvalkenburg
temporarily deployed
to
github-app-auth
July 29, 2026 20:11 — with
GitHub Actions
Inactive
eavanvalkenburg
temporarily deployed
to
github-app-auth
July 29, 2026 20:11 — with
GitHub Actions
Inactive
eavanvalkenburg
marked this pull request as ready for review
July 29, 2026 20:12
eavanvalkenburg
temporarily deployed
to
github-app-auth
July 29, 2026 20:13 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes AG-UI confirm_changes snapshot cleanup so the synthetic confirmation tool call is correlated back to the original function_call_id, preventing unrelated tool results from being substituted/concatenated when multiple tool results exist. It also adds deterministic fallbacks for accepted/declined/missing-result cases and ensures malformed confirmation metadata is treated as inert.
Changes:
- Add
_confirm_changes_target_call_idto resolve aconfirm_changestool result’s synthetic call id back to its original call id (via explicit payload or parsed tool-call arguments). - Update
_clean_resolved_approvals_from_snapshotto replace only the matching original tool result (or apply deterministic fallbacks), rather than potentially combining unrelated results. - Add focused unit tests and update AG-UI documentation/spec coverage to lock in the expected behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| python/packages/ag-ui/agent_framework_ag_ui/_agent_run.py | Implements original-call correlation for confirm_changes snapshot cleanup and deterministic fallbacks. |
| python/packages/ag-ui/tests/ag_ui/test_confirm_changes_snapshot.py | Adds regressions for multi-result correlation, explicit payload correlation, rejection/missing-result fallbacks, and malformed metadata handling. |
| python/packages/ag-ui/AGENTS.md | Documents the confirm_changes snapshot cleanup invariant (must not concatenate unrelated results). |
| docs/specs/004-python-function-calling-loop.md | Updates the spec’s invariant/test mapping to include the new confirm_changes snapshot coverage. |
Contributor
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||
TaoChenOSU
approved these changes
Jul 29, 2026
eavanvalkenburg
temporarily deployed
to
github-app-auth
July 30, 2026 05:34 — with
GitHub Actions
Inactive
eavanvalkenburg
enabled auto-merge
July 30, 2026 05:39
moonbox3
reviewed
Jul 30, 2026
eavanvalkenburg
temporarily deployed
to
github-app-auth
July 30, 2026 06:52 — with
GitHub Actions
Inactive
eavanvalkenburg
temporarily deployed
to
github-app-auth
July 30, 2026 06:52 — with
GitHub Actions
Inactive
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 1ee1d250-d1e2-4c6f-8c36-aae0d94fe7a1
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 1ee1d250-d1e2-4c6f-8c36-aae0d94fe7a1
Keep accepted confirm_changes snapshot payloads inert unless approval resolution produced a matching function result, while retaining explicit rejection cleanup. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 1ee1d250-d1e2-4c6f-8c36-aae0d94fe7a1
eavanvalkenburg
force-pushed
the
python-agui-confirm-changes-snapshot
branch
from
July 30, 2026 06:59
49e427d to
8699a49
Compare
eavanvalkenburg
temporarily deployed
to
github-app-auth
July 30, 2026 06:59 — with
GitHub Actions
Inactive
moonbox3
approved these changes
Jul 30, 2026
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
confirm_changesuses a synthetic confirmation call id. Snapshot cleanup can therefore miss the originaltool result or combine unrelated results when several calls are present.
Description & Review Guide
function_call_id.Related Issue
Fixes #6828
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.