Python: fix AG-UI service-session snapshot replay - #7770
Conversation
There was a problem hiding this comment.
Pull request overview
Separates service-managed provider history from AG-UI snapshot history.
Changes:
- Prevents stored snapshot replay into service-session provider calls.
- Reconstructs full snapshots for UI hydration.
- Adds split-authority regression coverage.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
_agent_run.py |
Separates provider input and persisted snapshots. |
test_snapshots.py |
Tests incremental provider input and full snapshot history. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
|
/review |
There was a problem hiding this comment.
MAF Automated Review — Iteration 1
Result: Findings reported
Scope: full PR (3 commit(s)): 3f0ac0ba31ed, 7d51557ce79c, 35527333f272
Model: gpt-5.6-sol
Overview
The review found 3 verified inline finding(s).
Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
3 verified findings remained after source verification (1 high, 2 medium) across 1 file. Details are attached to the affected lines below.
Affected areas: python/packages/ag-ui/agent_framework_ag_ui/_agent_run.py
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
3552733 to
5521340
Compare
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Motivation & Context
When
AgentFrameworkAgentcombinesuse_service_session=Truewith asnapshot_store, the provider service session must remain the sole authority for prior provider history. Replaying the AG-UI snapshot alongside an existing Foundry conversation or response ID can send historical assistant messages or tool results twice, causing Responses API validation failures.AG-UI
threadIdandrunIdvalues are client-owned protocol correlation IDs; they are not inherently provider conversation identifiers. This change keeps complete backend-owned snapshots for AG-UI hydration, sends only validated incremental input to the provider, and persists the provider continuation privately.Description & Review Guide
What are the major changes?
input_requiredcontinuation shapes.create_conversation()when supported; otherwise persist the provider-issued response ID for subsequentprevious_response_idcontinuation.service_session_id_from_thread_id=Truecompatibility behavior for applications that intentionally use a provider continuation ID as their AG-UI Thread ID.OpenAIChatClient→ local Responses host coverage, explicit Agent FrameworkMessage/Contenthistory coverage, and live Foundry Hosted Agent tests for pre-created and backend-created conversations.What is the impact of these changes?
threadIdcan preserve that behavior through the explicit compatibility option.What do you want reviewers to focus on?
Related Issue
Fixes #7710
Contribution Checklist