Skip to content

.NET: fix: keep injected messages in function loop history#6059

Open
he-yufeng wants to merge 1 commit into
microsoft:mainfrom
he-yufeng:fix/persist-injected-message-history
Open

.NET: fix: keep injected messages in function loop history#6059
he-yufeng wants to merge 1 commit into
microsoft:mainfrom
he-yufeng:fix/persist-injected-message-history

Conversation

@he-yufeng
Copy link
Copy Markdown
Contributor

Summary

  • keep drained MessageInjectingChatClient messages in the mutable history list used by the outer function invocation loop
  • add a regression test covering a second tool call after an injected user correction

Fixes #6056.

Tests

  • dotnet run --project dotnet\tests\Microsoft.Agents.AI.UnitTests\Microsoft.Agents.AI.UnitTests.csproj --framework net10.0 --no-restore -- --filter-method "Microsoft.Agents.AI.UnitTests.MessageInjectingChatClientTests.RunAsync_KeepsInjectedMessagesInFunctionLoopHistoryAsync" --no-progress
  • dotnet run --project dotnet\tests\Microsoft.Agents.AI.UnitTests\Microsoft.Agents.AI.UnitTests.csproj --framework net10.0 --no-restore -- --filter-class "Microsoft.Agents.AI.UnitTests.MessageInjectingChatClientTests" --no-progress
  • dotnet build dotnet\tests\Microsoft.Agents.AI.UnitTests\Microsoft.Agents.AI.UnitTests.csproj --no-restore
  • dotnet format dotnet\agent-framework-dotnet.slnx --verify-no-changes --include dotnet\src\Microsoft.Agents.AI\ChatClient\MessageInjectingChatClient.cs dotnet\tests\Microsoft.Agents.AI.UnitTests\ChatClient\MessageInjectingChatClientTests.cs --no-restore

Copilot AI review requested due to automatic review settings May 24, 2026 11:25
@moonbox3 moonbox3 added the .NET label May 24, 2026
@github-actions github-actions Bot changed the title fix: keep injected messages in function loop history .NET: fix: keep injected messages in function loop history May 24, 2026
Copy link
Copy Markdown
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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]: The MessageInjectingChatClient does not store the historical conversations of injected messages.

5 participants