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
@he-yufeng he-yufeng force-pushed the fix/agui-tool-result-raw-string branch from 29fa618 to f174656 Compare June 2, 2026 19:46
@he-yufeng

Copy link
Copy Markdown
Contributor Author

Rebased on current upstream/main and reran the scoped AGUI validation locally.

Validated:

dotnet build .\tests\Microsoft.Agents.AI.AGUI.UnitTests\Microsoft.Agents.AI.AGUI.UnitTests.csproj -f net10.0 -c Debug --tl:off
dotnet test --project .\tests\Microsoft.Agents.AI.AGUI.UnitTests\Microsoft.Agents.AI.AGUI.UnitTests.csproj -f net10.0 -c Debug --no-build -v Normal --report-xunit-trx --ignore-exit-code 8 -- --filter-class Microsoft.Agents.AI.AGUI.UnitTests.ChatResponseUpdateAGUIExtensionsTests
git diff --check upstream/main...HEAD

All passed after the rebase.

@he-yufeng he-yufeng force-pushed the fix/agui-tool-result-raw-string branch from f174656 to 5392ea8 Compare June 6, 2026 20:02
@he-yufeng

Copy link
Copy Markdown
Contributor Author

Rebased this PR onto the latest upstream main and re-ran the focused validation.

Validation:

  • git diff --check upstream/main..HEAD
  • dotnet build .\dotnet\tests\Microsoft.Agents.AI.AGUI.UnitTests\Microsoft.Agents.AI.AGUI.UnitTests.csproj -f net10.0 -c Debug --tl:off
  • 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 (47 passed)

@he-yufeng he-yufeng force-pushed the fix/agui-tool-result-raw-string branch from 5392ea8 to b5e84a1 Compare June 12, 2026 03:44
@he-yufeng

Copy link
Copy Markdown
Contributor Author

Rebased this branch onto current main and pushed the updated head b5e84a11.

Validation run locally from dotnet/:

  • dotnet build .\src\Microsoft.Agents.AI.AGUI\Microsoft.Agents.AI.AGUI.csproj -f net10.0 --tl:off -> passed, 0 warnings/errors
  • dotnet run --project .\tests\Microsoft.Agents.AI.AGUI.UnitTests\Microsoft.Agents.AI.AGUI.UnitTests.csproj -f net10.0 -> passed, 219 tests
  • git diff --check upstream/main..HEAD -> passed

I used dotnet run --project for the xUnit v3/MTP test project because dotnet test is not usable with this checkout's current runner configuration on my Windows machine.

@he-yufeng

Copy link
Copy Markdown
Contributor Author

Rebased this branch onto current main and pushed the updated head $head.

Validation run locally from dotnet/:

  • dotnet build .\src\Microsoft.Agents.AI.AGUI\Microsoft.Agents.AI.AGUI.csproj -f net10.0 --tl:off -> passed, 0 warnings/errors
  • dotnet run --project .\tests\Microsoft.Agents.AI.AGUI.UnitTests\Microsoft.Agents.AI.AGUI.UnitTests.csproj -f net10.0 -> passed, 219 tests
  • git diff --check upstream/main..HEAD -> passed

@he-yufeng he-yufeng force-pushed the fix/agui-tool-result-raw-string branch 3 times, most recently from d385f42 to 65a2012 Compare June 12, 2026 16:57
@he-yufeng he-yufeng force-pushed the fix/agui-tool-result-raw-string branch from 65a2012 to c3c4d32 Compare June 12, 2026 20:43
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