Skip to content

Conversation

@SergeyMenshykh
Copy link
Member

This PR disables scenarios that would experience message loss, such as streaming resumption with threads configured with either a custom message store or a context provider.

Closes: #1760

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 addresses a critical issue with message loss during streaming resumption by adding validation to prevent unsupported scenarios. The changes ensure that continuation tokens cannot be used with custom message stores or context providers during streaming operations, where collected updates could be lost.

Key changes:

  • Added validation in ValidateStreamResumptionAllowed to prevent streaming resumption with MessageStore or AIContextProvider
  • Added validation to prevent continuation tokens from being used on initial runs (when thread has no ConversationId and no MessageStore)
  • Updated existing tests to include ConversationId in thread and response objects to ensure tests represent realistic continuation scenarios
  • Added comprehensive test coverage for all new validation scenarios

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
dotnet/src/Microsoft.Agents.AI/ChatClient/ChatClientAgent.cs Implements new validation logic to prevent streaming resumption with MessageStore or AIContextProvider, and prevents continuation tokens on initial runs
dotnet/tests/Microsoft.Agents.AI.UnitTests/ChatClient/ChatClientAgentTests.cs Updates existing tests to use ConversationId and adds four new test cases covering all validation scenarios for continuation token usage

@SergeyMenshykh SergeyMenshykh added this pull request to the merge queue Nov 28, 2025
Merged via the queue into microsoft:main with commit 67de7bc Nov 28, 2025
18 of 21 checks passed
@github-project-automation github-project-automation bot moved this from In Review to Done in Agent Framework Nov 28, 2025
This was referenced Dec 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

.NET: [BackagroundResponses] ChatClientAgent.RunStreamingAsync updates loss on first run failure

3 participants