Skip to content

.NET: fix: tolerate raw AGUI tool result strings#6221

Open
he-yufeng wants to merge 1 commit into
microsoft:mainfrom
he-yufeng:fix/agui-tool-result-raw-string
Open

.NET: fix: tolerate raw AGUI tool result strings#6221
he-yufeng wants to merge 1 commit into
microsoft:mainfrom
he-yufeng:fix/agui-tool-result-raw-string

Conversation

@he-yufeng
Copy link
Copy Markdown
Contributor

Fixes #6220.

The AGUI converter serialized FunctionResultContent string values as raw text. The inbound AGUI -> MEAI path then parsed every tool result as JSON, so raw string content such as Success: Function completed. or True could throw JsonException.

This patch makes outbound string tool results valid JSON strings, while keeping the inbound path tolerant of older or external raw string content. Existing JSON object, bool, and number payloads still deserialize as JsonElement.

To verify

  • dotnet build dotnet\tests\Microsoft.Agents.AI.AGUI.UnitTests\Microsoft.Agents.AI.AGUI.UnitTests.csproj --no-restore
  • dotnet dotnet\tests\Microsoft.Agents.AI.AGUI.UnitTests\bin\Debug\net10.0\Microsoft.Agents.AI.AGUI.UnitTests.dll --filter-class Microsoft.Agents.AI.AGUI.UnitTests.ChatResponseUpdateAGUIExtensionsTests --no-progress
  • dotnet\tests\Microsoft.Agents.AI.AGUI.UnitTests\bin\Debug\net472\Microsoft.Agents.AI.AGUI.UnitTests.exe --filter-class Microsoft.Agents.AI.AGUI.UnitTests.ChatResponseUpdateAGUIExtensionsTests --no-progress
  • dotnet dotnet\tests\Microsoft.Agents.AI.AGUI.UnitTests\bin\Debug\net10.0\Microsoft.Agents.AI.AGUI.UnitTests.dll --no-progress
  • dotnet\tests\Microsoft.Agents.AI.AGUI.UnitTests\bin\Debug\net472\Microsoft.Agents.AI.AGUI.UnitTests.exe --no-progress
  • dotnet format dotnet\tests\Microsoft.Agents.AI.AGUI.UnitTests\Microsoft.Agents.AI.AGUI.UnitTests.csproj --include dotnet\src\Microsoft.Agents.AI.AGUI\Shared\ChatResponseUpdateAGUIExtensions.cs dotnet\tests\Microsoft.Agents.AI.AGUI.UnitTests\ChatResponseUpdateAGUIExtensionsTests.cs --verify-no-changes --no-restore
  • git diff --check

Copilot AI review requested due to automatic review settings May 31, 2026 08:14
@moonbox3 moonbox3 added the .NET label May 31, 2026
@github-actions github-actions Bot changed the title fix: tolerate raw AGUI tool result strings .NET: fix: tolerate raw AGUI tool result strings May 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET: [Bug]: Approval response false throwing error in AGUI Client

2 participants