You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ChatHistoryMemoryProvider treats vector search and history storage failures as best-effort, but its generic exception handlers also swallow OperationCanceledException when the caller-provided CancellationToken has been cancelled.
This affects both the BeforeAIInvoke search path and the post-invocation UpsertAsync storage path, allowing work to continue after caller cancellation.
Expected behavior
Caller-triggered cancellation should propagate. Unrelated provider-side failures, including provider-side cancellation when the caller token remains active, should keep the existing best-effort behavior.
Reproduction
With an already-cancelled caller token, configure SearchAsync or UpsertAsync to surface cancellation. Both paths currently complete without propagating OperationCanceledException.
The fix can remain narrow by filtering the generic catch based on whether the caller token is actually cancelled.
🤖 Automated triage reproduction notes(agent-authored — trust but verify)
Agent analysis
dotnet/src/Microsoft.Agents.AI/Memory/ChatHistoryMemoryProvider.cs::ProvideMessagesAsync and StoreAIContextAsync swallow caller-triggered cancellation in their generic exception handlers at lines 242 and 295. This occurs when an already-canceled caller token is passed and SearchAsync or UpsertAsync throws OperationCanceledException. Minimal repro: mock either vector-store operation to throw cancellation, invoke the provider with that cancelled token, and assert cancellation propagates.
Activity
github-actions commentedon Sep 29, 2026
🤖 Automated triage reproduction notes (agent-authored — trust but verify)
Agent analysis
dotnet/src/Microsoft.Agents.AI/Memory/ChatHistoryMemoryProvider.cs::ProvideMessagesAsyncandStoreAIContextAsyncswallow caller-triggered cancellation in their generic exception handlers at lines 242 and 295. This occurs when an already-canceled caller token is passed andSearchAsyncorUpsertAsyncthrowsOperationCanceledException. Minimal repro: mock either vector-store operation to throw cancellation, invoke the provider with that cancelled token, and assert cancellation propagates.dotnet/tests/Microsoft.Agents.AI.UnitTests/Memory/ChatHistoryMemoryProviderTests.cs