Skip to content

Conversation

@westey-m
Copy link
Contributor

Motivation and Context

#3104

Description

  • Allow overriding the ChatMessageStore to be used per agent run via AdditionalProperties
  • Moved all ChatMessageStore and ConversationId tests into a separate test file to reduce the side of the main ChatClientAgentTests file.

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.

Copilot AI review requested due to automatic review settings January 21, 2026 14:42
@github-actions github-actions bot changed the title Allow overriding the ChatMessageStore to be used per agent run. .NET: Allow overriding the ChatMessageStore to be used per agent run. Jan 21, 2026
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 pull request adds functionality to allow overriding the ChatMessageStore on a per-agent-run basis via AdditionalProperties. The PR also reorganizes tests by moving ChatMessageStore and ConversationId related tests into a separate file.

Changes:

  • Added AdditionalPropertiesExtensions with type-based key storage/retrieval for AdditionalPropertiesDictionary
  • Implemented ResolveChatMessageStore to support ChatMessageStore overrides via AdditionalProperties
  • Made ChatMessageStoreMessages nullable in InvokedContext to handle first-run scenarios
  • Reorganized tests by moving chat history management tests to a dedicated file

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
dotnet/src/Microsoft.Agents.AI.Abstractions/AdditionalPropertiesExtensions.cs New extension methods for type-based storage/retrieval in AdditionalPropertiesDictionary
dotnet/src/Microsoft.Agents.AI.Abstractions/ChatMessageStore.cs Made ChatMessageStoreMessages parameter nullable in InvokedContext constructor
dotnet/src/Microsoft.Agents.AI/ChatClient/ChatClientAgent.cs Added ResolveChatMessageStore method and updated all notification call sites to pass chatOptions
dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests/AdditionalPropertiesExtensionsTests.cs Comprehensive tests for AdditionalPropertiesExtensions
dotnet/tests/Microsoft.Agents.AI.UnitTests/ChatClient/ChatClientAgent_ChatHistoryManagementTests.cs New test file consolidating ChatMessageStore and ConversationId tests, including override test
dotnet/tests/Microsoft.Agents.AI.UnitTests/ChatClient/ChatClientAgentTests.cs Removed tests that were moved to ChatHistoryManagementTests
dotnet/tests/Microsoft.Agents.AI.UnitTests/ChatClient/ChatClientAgent_DeserializeThreadTests.cs Namespace changed for consistency
dotnet/tests/Microsoft.Agents.AI.UnitTests/ChatClient/ChatClientAgent_GetNewThreadTests.cs Namespace changed for consistency
dotnet/tests/Microsoft.Agents.AI.UnitTests/ChatClient/ChatClientAgentContinuationTokenTests.cs Namespace changed for consistency

@westey-m westey-m added this pull request to the merge queue Jan 22, 2026
github-merge-queue bot pushed a commit that referenced this pull request Jan 22, 2026
…#3330)

* Allow overriding the ChatMessageStore to be used per agent run.

* Fix typos

* Fix Add and add TryAdd, Contains and Remove
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 22, 2026
@westey-m westey-m added this pull request to the merge queue Jan 23, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 23, 2026
@westey-m westey-m added this pull request to the merge queue Jan 23, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 23, 2026
@westey-m westey-m added this pull request to the merge queue Jan 23, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 23, 2026
@westey-m westey-m added this pull request to the merge queue Jan 23, 2026
Merged via the queue into microsoft:main with commit 90164a6 Jan 23, 2026
14 checks passed
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.

4 participants