Python: Preserve declaration-only streaming metadata - #7409
Open
eavanvalkenburg wants to merge 2 commits into
Open
Python: Preserve declaration-only streaming metadata#7409eavanvalkenburg wants to merge 2 commits into
eavanvalkenburg wants to merge 2 commits into
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
marked this pull request as ready for review
July 29, 2026 20:12
eavanvalkenburg
temporarily deployed
to
github-app-auth
July 29, 2026 20:12 — with
GitHub Actions
Inactive
Contributor
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a Python streaming edge case where declaration-only tool calls could end up with duplicated arguments in the finalized response by ensuring the function-invocation layer emits metadata-only updates while preserving control metadata during content aggregation.
Changes:
- Emit a metadata-only finalized declaration update (
arguments=None) during streaming so provider-streamed argument chunks aren’t replayed/duplicated. - Preserve
idanduser_input_requestwhen aggregatingfunction_callContentinstances. - Add regression tests for split-argument vs single-chunk streams, and document the behavior in the Python agent conventions/spec.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| python/packages/core/agent_framework/_tools.py | Emits metadata-only function_call streaming updates to avoid replaying streamed arguments. |
| python/packages/core/agent_framework/_types.py | Propagates id and user_input_request through function_call content aggregation. |
| python/packages/core/tests/core/test_function_invocation_logic.py | Adds streaming regression coverage for declaration-only calls (split and single-chunk arguments). |
| python/packages/core/tests/core/test_types.py | Adds unit coverage ensuring metadata-only follow-ups preserve control metadata without altering arguments. |
| python/packages/core/AGENTS.md | Documents the declaration-only streaming behavior and metadata-only follow-up semantics. |
| docs/specs/004-python-function-calling-loop.md | Updates spec/test matrix to reflect the new covered regression scenario for #6973. |
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:38
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
eavanvalkenburg
force-pushed
the
python-declaration-only-streaming
branch
from
July 30, 2026 06:59
996ce38 to
ae50232
Compare
eavanvalkenburg
temporarily deployed
to
github-app-auth
July 30, 2026 06:59 — with
GitHub Actions
Inactive
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
Streaming declaration-only calls currently replay the finalized arguments after the provider already streamed
them, causing the final response to concatenate the arguments twice.
Description & Review Guide
arguments=None.idanduser_input_requestwhile function-call chunks are aggregated.request_infosignaling for client-side tools.Contentaddition.Related Issue
Fixes #6973
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.