Uh oh!
There was an error while loading. Please reload this page.
.NET: Prevent streamed updates loss when resuming streaming - #2516
Conversation
…anaged store or/and context provider
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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
ValidateStreamResumptionAllowedto 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 |
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: westey <164392973+westey-m@users.noreply.github.com>
Co-authored-by: westey <164392973+westey-m@users.noreply.github.com>
…t#2516) * prevent stremed updates loss when resuming streaming with non-agent managed store or/and context provider * Update dotnet/src/Microsoft.Agents.AI/ChatClient/ChatClientAgent.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * throw not supported exception instead invalid operation * Update dotnet/src/Microsoft.Agents.AI/ChatClient/ChatClientAgent.cs Co-authored-by: westey <164392973+westey-m@users.noreply.github.com> * Update dotnet/src/Microsoft.Agents.AI/ChatClient/ChatClientAgent.cs Co-authored-by: westey <164392973+westey-m@users.noreply.github.com> * use conversation id to check if chat history is managed by agent service or not * extract background responses tests into a separate file --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: westey <164392973+westey-m@users.noreply.github.com>
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