Skip to content

Python: Fix ag-ui regressions#2114

Merged
moonbox3 merged 9 commits intomicrosoft:mainfrom
moonbox3:fix-ag-ui-bugs
Nov 13, 2025
Merged

Python: Fix ag-ui regressions#2114
moonbox3 merged 9 commits intomicrosoft:mainfrom
moonbox3:fix-ag-ui-bugs

Conversation

@moonbox3
Copy link
Contributor

Motivation and Context

While introducing the AGUIChatClient, the related code changes affected the Dojo examples that were previously published. This PR fixes those regressions and now allows for the use of all seven examples, along with client tools, which previously wasn't working properly. More unit tests were added now for a 94% coverage across the ag-ui code.

Description

Fixes regressions. Adds more tests

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

@moonbox3 moonbox3 self-assigned this Nov 12, 2025
Copilot AI review requested due to automatic review settings November 12, 2025 05:51
@markwallace-microsoft
Copy link
Member

markwallace-microsoft commented Nov 12, 2025

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/ag-ui/agent_framework_ag_ui
   _events.py258797%146, 272, 291, 322, 565–566, 597
   _message_adapters.py1303076%57, 87, 95–96, 98, 102–105, 118, 200, 202–203, 205–209, 211, 213–214, 237, 239, 241–242, 244–246, 259, 261
   _orchestrators.py3703091%137, 454, 491, 521–522, 554, 616–618, 626–627, 633–634, 638–639, 653–654, 694–696, 703, 706–707, 710–713, 715–717
TOTAL13830201085% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
1856 109 💤 0 ❌ 0 🔥 37.019s ⏱️

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes regressions in the AG-UI code that affected Dojo examples and client tool functionality. The changes improve tool result handling, message sanitization, and orchestration logic to properly support human-in-the-loop approval flows and declaration-only frontend rendering tools.

Key Changes:

  • Fixed message adapter logic to properly distinguish between approval responses and tool results
  • Added message sanitization to filter orphaned tool results and inject synthetic results for confirm_changes
  • Fixed client tool merging to avoid overriding agent-configured tools with duplicate names
  • Added comprehensive unit tests achieving 94% coverage

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
test_orchestrators_coverage.py New comprehensive test file covering orchestrator edge cases and sanitization logic
test_agent_wrapper_comprehensive.py Updated test expectations for orphaned tool result handling
main.py Added startup logging messages for the AG-UI examples server
ui_generator_agent.py Converted @ai_function decorators to AIFunction declarations for frontend-rendered tools
_orchestrators.py Major refactor adding message sanitization, deduplication, and improved tool merging logic
_message_adapters.py Refactored tool result message handling to fix approval response detection
_events.py Added tracking for tool calls that have ended to prevent duplicate events
launch.json Fixed module name for debugging configuration
Comments suppressed due to low confidence (1)

python/packages/ag-ui/tests/test_orchestrators_coverage.py:1

  • This if False: block is used to make the async generator syntactically valid without yielding. A cleaner approach would be to use return or raise AssertionError(...) directly without the dead code block.
# Copyright (c) Microsoft. All rights reserved.

@moonbox3 moonbox3 added the ag-ui label Nov 12, 2025
@markwallace-microsoft markwallace-microsoft added the documentation Improvements or additions to documentation label Nov 12, 2025
@moonbox3 moonbox3 added this pull request to the merge queue Nov 12, 2025
@moonbox3 moonbox3 removed this pull request from the merge queue due to a manual request Nov 12, 2025
@moonbox3 moonbox3 enabled auto-merge November 12, 2025 23:58
@moonbox3 moonbox3 added this pull request to the merge queue Nov 13, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Nov 13, 2025
@moonbox3 moonbox3 added this pull request to the merge queue Nov 13, 2025
Merged via the queue into microsoft:main with commit 5537b1d Nov 13, 2025
24 checks passed
arisng pushed a commit to arisng/agent-framework that referenced this pull request Feb 2, 2026
* Bump ag-ui package version. Update CHANGELOG

* Fix ag-ui bugs

* Revert port test change

* Cleanup

* Intro factory funcs for samples

* Revert package ver change
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ag-ui documentation Improvements or additions to documentation python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants