Skip to content

Python: Fix duplicate streamed tool calls in DevUI - #7652

Open
Chinedum Echeta (cecheta) wants to merge 1 commit into
microsoft:mainfrom
cecheta:fix/devui-duplicate-tool-calls
Open

Python: Fix duplicate streamed tool calls in DevUI#7652
Chinedum Echeta (cecheta) wants to merge 1 commit into
microsoft:mainfrom
cecheta:fix/devui-duplicate-tool-calls

Conversation

@cecheta

Copy link
Copy Markdown
Member

Motivation & Context

DevUI renders repeated copies of a single streamed tool call when the provider includes the same call ID and function name on each arguments chunk. This makes one framework tool execution appear as several calls in the chat.

The mapper should announce each unique function call once and continue forwarding all argument deltas for that call.

Description & Review Guide

  • What are the major changes? MessageMapper now emits response.output_item.added only when a function call ID is first observed. A regression test covers two argument chunks that repeat the same call metadata.
  • What is the impact of these changes? DevUI displays one tool-call item per framework call while preserving streamed arguments. There is no public API change.
  • What do you want reviewers to focus on? Confirm that using the request-scoped active_function_calls map correctly handles repeated provider metadata without affecting parallel calls.

Related Issue

Fixes #7651

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR is linked to an issue and there is no other open PR for this issue (see Related Issue above).
  • This is not a breaking change. If it is a breaking change, add the breaking change label (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.

Copilot AI balanced review requested due to automatic review settings August 13, 2026 16:49
@agent-framework-automation agent-framework-automation Bot added the python Usage: [Issues, PRs], Target: Python label Aug 13, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes duplicate DevUI tool-call items while preserving streamed argument deltas.

Changes:

  • Emits tool-call creation events only for unseen call IDs.
  • Adds regression coverage for repeated streamed metadata.
Show a summary per file
File Description
python/packages/devui/agent_framework_devui/_mapper.py Deduplicates streamed tool-call items by call ID.
python/packages/devui/tests/devui/test_mapper.py Tests single-item emission and complete argument streaming.

Review details

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

@github-actions

Copy link
Copy Markdown
Contributor

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
TOTAL45879423990% 
report-only-changed-files is enabled. No files were changed during this commit :)

Python Unit Test Overview

Tests Skipped Failures Errors Time
9346 36 💤 0 ❌ 0 🔥 2m 32s ⏱️

@cecheta
Chinedum Echeta (cecheta) marked this pull request as ready for review August 13, 2026 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python: [Bug]: DevUI repeats streamed tool calls

3 participants