Python: Enhance _OutputItemTracker to prevent duplicate function call streaming - #7486
Open
cecheta wants to merge 3 commits into
Open
Python: Enhance _OutputItemTracker to prevent duplicate function call streaming#7486cecheta wants to merge 3 commits into
cecheta wants to merge 3 commits into
Conversation
Contributor
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a Foundry Hosting streaming bug in the Python implementation where a declaration-only tool invocation can result in a duplicate function_call output item being streamed to the client. The change extends the streaming output-item tracker to recognize and suppress the metadata-only duplicate call, and adds a regression test covering the scenario.
Changes:
- Track previously-streamed function call
call_ids during a streaming response. - Suppress streaming of metadata-only duplicate function-call updates for already-seen
call_ids. - Add a regression test ensuring only one
function_calloutput item is emitted for declaration-only metadata follow-ups.
Show a summary per file
| File | Description |
|---|---|
| python/packages/foundry_hosting/agent_framework_foundry_hosting/_responses.py | Adds duplicate-detection logic in _OutputItemTracker to prevent streaming a second metadata-only function call item. |
| python/packages/foundry_hosting/tests/test_responses.py | Adds a regression test reproducing the declaration-only metadata duplication scenario in streaming mode. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
moonbox3
reviewed
Aug 4, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9b232bff-6a8c-4b02-addd-89de57a82f6a
…lls and update tests for call ID reuse
cecheta
force-pushed
the
tool-fix-streaming
branch
from
August 4, 2026 10:11
5e0b43d to
d48c60e
Compare
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
Fixes bug where function call was duplicated when streaming response from declaration-only tool,
Description & Review Guide
When the agent invokes the declaration-only tool, there is a second function call emitted containing just metadata. Both of these tools were being streamed to the user.
Related Issue
Fixes #7485
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.