This commit is contained in:
Chris Rickman
2026-03-05 02:35:52 -08:00
Unverified
parent b275d3410a
commit dda15ea4b4
9 changed files with 74 additions and 86 deletions
@@ -64,7 +64,7 @@ internal sealed class CompactingChatClient : DelegatingChatClient
[EnumeratorCancellation] CancellationToken cancellationToken = default)
{
IEnumerable<ChatMessage> compactedMessages = await this.ApplyCompactionAsync(messages, cancellationToken).ConfigureAwait(false);
await foreach (var update in base.GetStreamingResponseAsync(compactedMessages, options, cancellationToken).ConfigureAwait(false))
await foreach (ChatResponseUpdate update in base.GetStreamingResponseAsync(compactedMessages, options, cancellationToken).ConfigureAwait(false))
{
yield return update;
}
@@ -15,7 +15,7 @@ namespace Microsoft.Agents.AI.Compaction;
public static class CompactionTriggers
{
/// <summary>
/// Always triger compaction, regardless of the message index state.
/// Always trigger compaction, regardless of the message index state.
/// </summary>
public static readonly CompactionTrigger Always =
_ => true;
@@ -240,8 +240,6 @@ public sealed class MessageIndex
/// <returns>A list of all <see cref="ChatMessage"/> instances, in order.</returns>
public IEnumerable<ChatMessage> GetAllMessages() => this.Groups.SelectMany(group => group.Messages);
#region Total aggregates (all groups, including excluded)
/// <summary>
/// Gets the total number of groups, including excluded ones.
/// </summary>
@@ -262,10 +260,6 @@ public sealed class MessageIndex
/// </summary>
public int TotalTokenCount => this.Groups.Sum(g => g.TokenCount);
#endregion
#region Included aggregates (non-excluded groups only)
/// <summary>
/// Gets the total number of groups that are not excluded.
/// </summary>
@@ -286,10 +280,6 @@ public sealed class MessageIndex
/// </summary>
public int IncludedTokenCount => this.Groups.Where(g => !g.IsExcluded).Sum(g => g.TokenCount);
#endregion
#region Turn aggregates
/// <summary>
/// Gets the total number of user turns across all groups (including those with excluded groups).
/// </summary>
@@ -308,8 +298,6 @@ public sealed class MessageIndex
public IEnumerable<MessageGroup> GetTurnGroups(int turnIndex) =>
this.Groups.Where(g => g.TurnIndex == turnIndex);
#endregion
/// <summary>
/// Computes the UTF-8 byte count for a set of messages.
/// </summary>
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft. All rights reserved.
// Copyright (c) Microsoft. All rights reserved.
using Microsoft.Agents.AI.Compaction;
using Microsoft.Extensions.AI;
@@ -11,7 +11,7 @@ namespace Microsoft.Agents.AI.UnitTests.Compaction;
public class CompactionTriggersTests
{
[Fact]
public void TokensExceed_ReturnsTrueWhenAboveThreshold()
public void TokensExceedReturnsTrueWhenAboveThreshold()
{
// Arrange — use a long message to guarantee tokens > 0
CompactionTrigger trigger = CompactionTriggers.TokensExceed(0);
@@ -22,7 +22,7 @@ public class CompactionTriggersTests
}
[Fact]
public void TokensExceed_ReturnsFalseWhenBelowThreshold()
public void TokensExceedReturnsFalseWhenBelowThreshold()
{
CompactionTrigger trigger = CompactionTriggers.TokensExceed(999_999);
MessageIndex index = MessageIndex.Create([new ChatMessage(ChatRole.User, "Hi")]);
@@ -31,7 +31,7 @@ public class CompactionTriggersTests
}
[Fact]
public void MessagesExceed_ReturnsExpectedResult()
public void MessagesExceedReturnsExpectedResult()
{
CompactionTrigger trigger = CompactionTriggers.MessagesExceed(2);
MessageIndex small = MessageIndex.Create(
@@ -51,7 +51,7 @@ public class CompactionTriggersTests
}
[Fact]
public void TurnsExceed_ReturnsExpectedResult()
public void TurnsExceedReturnsExpectedResult()
{
CompactionTrigger trigger = CompactionTriggers.TurnsExceed(1);
MessageIndex oneTurn = MessageIndex.Create(
@@ -71,7 +71,7 @@ public class CompactionTriggersTests
}
[Fact]
public void GroupsExceed_ReturnsExpectedResult()
public void GroupsExceedReturnsExpectedResult()
{
CompactionTrigger trigger = CompactionTriggers.GroupsExceed(2);
MessageIndex index = MessageIndex.Create(
@@ -85,7 +85,7 @@ public class CompactionTriggersTests
}
[Fact]
public void HasToolCalls_ReturnsTrueWhenToolCallGroupExists()
public void HasToolCallsReturnsTrueWhenToolCallGroupExists()
{
CompactionTrigger trigger = CompactionTriggers.HasToolCalls();
MessageIndex index = MessageIndex.Create(
@@ -99,7 +99,7 @@ public class CompactionTriggersTests
}
[Fact]
public void HasToolCalls_ReturnsFalseWhenNoToolCallGroup()
public void HasToolCallsReturnsFalseWhenNoToolCallGroup()
{
CompactionTrigger trigger = CompactionTriggers.HasToolCalls();
MessageIndex index = MessageIndex.Create(
@@ -112,7 +112,7 @@ public class CompactionTriggersTests
}
[Fact]
public void All_RequiresAllConditions()
public void AllRequiresAllConditions()
{
CompactionTrigger trigger = CompactionTriggers.All(
CompactionTriggers.TokensExceed(0),
@@ -125,7 +125,7 @@ public class CompactionTriggersTests
}
[Fact]
public void Any_RequiresAtLeastOneCondition()
public void AnyRequiresAtLeastOneCondition()
{
CompactionTrigger trigger = CompactionTriggers.Any(
CompactionTriggers.TokensExceed(999_999),
@@ -138,7 +138,7 @@ public class CompactionTriggersTests
}
[Fact]
public void All_EmptyTriggers_ReturnsTrue()
public void AllEmptyTriggersReturnsTrue()
{
CompactionTrigger trigger = CompactionTriggers.All();
MessageIndex index = MessageIndex.Create([new ChatMessage(ChatRole.User, "A")]);
@@ -146,7 +146,7 @@ public class CompactionTriggersTests
}
[Fact]
public void Any_EmptyTriggers_ReturnsFalse()
public void AnyEmptyTriggersReturnsFalse()
{
CompactionTrigger trigger = CompactionTriggers.Any();
MessageIndex index = MessageIndex.Create([new ChatMessage(ChatRole.User, "A")]);
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft. All rights reserved.
// Copyright (c) Microsoft. All rights reserved.
using System.Collections.Generic;
using Microsoft.Agents.AI.Compaction;
@@ -12,7 +12,7 @@ namespace Microsoft.Agents.AI.UnitTests.Compaction;
public class MessageIndexTests
{
[Fact]
public void Create_EmptyList_ReturnsEmptyGroups()
public void CreateEmptyListReturnsEmptyGroups()
{
// Arrange
List<ChatMessage> messages = [];
@@ -25,7 +25,7 @@ public class MessageIndexTests
}
[Fact]
public void Create_SystemMessage_CreatesSystemGroup()
public void CreateSystemMessageCreatesSystemGroup()
{
// Arrange
List<ChatMessage> messages =
@@ -43,7 +43,7 @@ public class MessageIndexTests
}
[Fact]
public void Create_UserMessage_CreatesUserGroup()
public void CreateUserMessageCreatesUserGroup()
{
// Arrange
List<ChatMessage> messages =
@@ -60,7 +60,7 @@ public class MessageIndexTests
}
[Fact]
public void Create_AssistantTextMessage_CreatesAssistantTextGroup()
public void CreateAssistantTextMessageCreatesAssistantTextGroup()
{
// Arrange
List<ChatMessage> messages =
@@ -77,7 +77,7 @@ public class MessageIndexTests
}
[Fact]
public void Create_ToolCallWithResults_CreatesAtomicToolCallGroup()
public void CreateToolCallWithResultsCreatesAtomicToolCallGroup()
{
// Arrange
ChatMessage assistantMessage = new(ChatRole.Assistant, [new FunctionCallContent("call1", "get_weather", new Dictionary<string, object?> { ["city"] = "Seattle" })]);
@@ -97,7 +97,7 @@ public class MessageIndexTests
}
[Fact]
public void Create_MixedConversation_GroupsCorrectly()
public void CreateMixedConversationGroupsCorrectly()
{
// Arrange
ChatMessage systemMsg = new(ChatRole.System, "You are helpful.");
@@ -121,7 +121,7 @@ public class MessageIndexTests
}
[Fact]
public void Create_MultipleToolResults_GroupsAllWithAssistant()
public void CreateMultipleToolResultsGroupsAllWithAssistant()
{
// Arrange
ChatMessage assistantToolCall = new(ChatRole.Assistant, [
@@ -143,7 +143,7 @@ public class MessageIndexTests
}
[Fact]
public void GetIncludedMessages_ExcludesMarkedGroups()
public void GetIncludedMessagesExcludesMarkedGroups()
{
// Arrange
ChatMessage msg1 = new(ChatRole.User, "First");
@@ -163,7 +163,7 @@ public class MessageIndexTests
}
[Fact]
public void GetAllMessages_IncludesExcludedGroups()
public void GetAllMessagesIncludesExcludedGroups()
{
// Arrange
ChatMessage msg1 = new(ChatRole.User, "First");
@@ -180,7 +180,7 @@ public class MessageIndexTests
}
[Fact]
public void IncludedGroupCount_ReflectsExclusions()
public void IncludedGroupCountReflectsExclusions()
{
// Arrange
MessageIndex groups = MessageIndex.Create(
@@ -198,7 +198,7 @@ public class MessageIndexTests
}
[Fact]
public void Create_SummaryMessage_CreatesSummaryGroup()
public void CreateSummaryMessageCreatesSummaryGroup()
{
// Arrange
ChatMessage summaryMessage = new(ChatRole.Assistant, "[Summary of earlier conversation]: key facts...");
@@ -216,7 +216,7 @@ public class MessageIndexTests
}
[Fact]
public void Create_SummaryAmongOtherMessages_GroupsCorrectly()
public void CreateSummaryAmongOtherMessagesGroupsCorrectly()
{
// Arrange
ChatMessage systemMsg = new(ChatRole.System, "You are helpful.");
@@ -237,7 +237,7 @@ public class MessageIndexTests
}
[Fact]
public void MessageGroup_StoresPassedCounts()
public void MessageGroupStoresPassedCounts()
{
// Arrange & Act
MessageGroup group = new(MessageGroupKind.User, [new ChatMessage(ChatRole.User, "Hello")], byteCount: 5, tokenCount: 2);
@@ -249,7 +249,7 @@ public class MessageIndexTests
}
[Fact]
public void MessageGroup_MessagesAreImmutable()
public void MessageGroupMessagesAreImmutable()
{
// Arrange
IReadOnlyList<ChatMessage> messages = [new ChatMessage(ChatRole.User, "Hello")];
@@ -261,7 +261,7 @@ public class MessageIndexTests
}
[Fact]
public void Create_ComputesByteCount_Utf8()
public void CreateComputesByteCountUtf8()
{
// Arrange — "Hello" is 5 UTF-8 bytes
MessageIndex groups = MessageIndex.Create([new ChatMessage(ChatRole.User, "Hello")]);
@@ -271,7 +271,7 @@ public class MessageIndexTests
}
[Fact]
public void Create_ComputesByteCount_MultiByteChars()
public void CreateComputesByteCountMultiByteChars()
{
// Arrange — "café" has a multi-byte 'é' (2 bytes in UTF-8) → 5 bytes total
MessageIndex groups = MessageIndex.Create([new ChatMessage(ChatRole.User, "café")]);
@@ -281,7 +281,7 @@ public class MessageIndexTests
}
[Fact]
public void Create_ComputesByteCount_MultipleMessagesInGroup()
public void CreateComputesByteCountMultipleMessagesInGroup()
{
// Arrange — ToolCall group: assistant (tool call, null text) + tool result "OK" (2 bytes)
ChatMessage assistantMsg = new(ChatRole.Assistant, [new FunctionCallContent("call1", "fn")]);
@@ -295,7 +295,7 @@ public class MessageIndexTests
}
[Fact]
public void Create_DefaultTokenCount_IsHeuristic()
public void CreateDefaultTokenCountIsHeuristic()
{
// Arrange — "Hello world test data!" = 22 UTF-8 bytes → 22 / 4 = 5 estimated tokens
MessageIndex groups = MessageIndex.Create([new ChatMessage(ChatRole.User, "Hello world test data!")]);
@@ -306,7 +306,7 @@ public class MessageIndexTests
}
[Fact]
public void Create_NullText_HasZeroCounts()
public void CreateNullTextHasZeroCounts()
{
// Arrange — message with no text (e.g., pure function call)
ChatMessage msg = new(ChatRole.Assistant, [new FunctionCallContent("call1", "get_weather")]);
@@ -320,7 +320,7 @@ public class MessageIndexTests
}
[Fact]
public void TotalAggregates_SumAllGroups()
public void TotalAggregatesSumAllGroups()
{
// Arrange
MessageIndex groups = MessageIndex.Create(
@@ -339,7 +339,7 @@ public class MessageIndexTests
}
[Fact]
public void IncludedAggregates_ExcludeMarkedGroups()
public void IncludedAggregatesExcludeMarkedGroups()
{
// Arrange
MessageIndex groups = MessageIndex.Create(
@@ -363,7 +363,7 @@ public class MessageIndexTests
}
[Fact]
public void ToolCallGroup_AggregatesAcrossMessages()
public void ToolCallGroupAggregatesAcrossMessages()
{
// Arrange — tool call group with assistant "Ask" (3 bytes) + tool result "OK" (2 bytes)
ChatMessage assistantMsg = new(ChatRole.Assistant, [new FunctionCallContent("call1", "fn")]);
@@ -380,7 +380,7 @@ public class MessageIndexTests
}
[Fact]
public void Create_AssignsTurnIndices_SingleTurn()
public void CreateAssignsTurnIndicesSingleTurn()
{
// Arrange — System (no turn), User + Assistant = turn 1
MessageIndex groups = MessageIndex.Create(
@@ -399,7 +399,7 @@ public class MessageIndexTests
}
[Fact]
public void Create_AssignsTurnIndices_MultiTurn()
public void CreateAssignsTurnIndicesMultiTurn()
{
// Arrange — 3 user turns
MessageIndex groups = MessageIndex.Create(
@@ -423,7 +423,7 @@ public class MessageIndexTests
}
[Fact]
public void Create_TurnSpansToolCallGroups()
public void CreateTurnSpansToolCallGroups()
{
// Arrange — turn 1 includes User, ToolCall, AssistantText
ChatMessage assistantToolCall = new(ChatRole.Assistant, [new FunctionCallContent("call1", "get_weather")]);
@@ -446,7 +446,7 @@ public class MessageIndexTests
}
[Fact]
public void GetTurnGroups_ReturnsGroupsForSpecificTurn()
public void GetTurnGroupsReturnsGroupsForSpecificTurn()
{
// Arrange
MessageIndex groups = MessageIndex.Create(
@@ -472,7 +472,7 @@ public class MessageIndexTests
}
[Fact]
public void IncludedTurnCount_ReflectsExclusions()
public void IncludedTurnCountReflectsExclusions()
{
// Arrange — 2 turns, exclude all groups in turn 1
MessageIndex groups = MessageIndex.Create(
@@ -492,7 +492,7 @@ public class MessageIndexTests
}
[Fact]
public void TotalTurnCount_ZeroWhenNoUserMessages()
public void TotalTurnCountZeroWhenNoUserMessages()
{
// Arrange — only system messages
MessageIndex groups = MessageIndex.Create(
@@ -506,7 +506,7 @@ public class MessageIndexTests
}
[Fact]
public void IncludedTurnCount_PartialExclusion_StillCountsTurn()
public void IncludedTurnCountPartialExclusionStillCountsTurn()
{
// Arrange — turn 1 has 2 groups, only one excluded
MessageIndex groups = MessageIndex.Create(
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft. All rights reserved.
// Copyright (c) Microsoft. All rights reserved.
using System;
using System.Collections.Generic;
@@ -15,7 +15,7 @@ namespace Microsoft.Agents.AI.UnitTests.Compaction;
public class PipelineCompactionStrategyTests
{
[Fact]
public async Task CompactAsync_ExecutesAllStrategiesInOrderAsync()
public async Task CompactAsyncExecutesAllStrategiesInOrderAsync()
{
// Arrange
List<string> executionOrder = [];
@@ -44,7 +44,7 @@ public class PipelineCompactionStrategyTests
}
[Fact]
public async Task CompactAsync_ReturnsFalse_WhenNoStrategyCompactsAsync()
public async Task CompactAsyncReturnsFalseWhenNoStrategyCompactsAsync()
{
// Arrange
TestCompactionStrategy strategy1 = new(_ => false);
@@ -60,7 +60,7 @@ public class PipelineCompactionStrategyTests
}
[Fact]
public async Task CompactAsync_ReturnsTrue_WhenAnyStrategyCompactsAsync()
public async Task CompactAsyncReturnsTrueWhenAnyStrategyCompactsAsync()
{
// Arrange
TestCompactionStrategy strategy1 = new(_ => false);
@@ -77,7 +77,7 @@ public class PipelineCompactionStrategyTests
}
[Fact]
public async Task CompactAsync_ContinuesAfterFirstCompaction_WhenEarlyStopDisabledAsync()
public async Task CompactAsyncContinuesAfterFirstCompactionAsync()
{
// Arrange
TestCompactionStrategy strategy1 = new(_ => true);
@@ -95,7 +95,7 @@ public class PipelineCompactionStrategyTests
}
[Fact]
public async Task CompactAsync_ComposesStrategies_EndToEndAsync()
public async Task CompactAsyncComposesStrategiesEndToEndAsync()
{
// Arrange — pipeline: first exclude oldest 2 non-system groups, then exclude 2 more
static void ExcludeOldest2(MessageIndex index)
@@ -154,7 +154,7 @@ public class PipelineCompactionStrategyTests
}
[Fact]
public async Task CompactAsync_EmptyPipeline_ReturnsFalseAsync()
public async Task CompactAsyncEmptyPipelineReturnsFalseAsync()
{
// Arrange
PipelineCompactionStrategy pipeline = new(new List<CompactionStrategy>());
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft. All rights reserved.
// Copyright (c) Microsoft. All rights reserved.
using System.Collections.Generic;
using System.Threading.Tasks;
@@ -13,7 +13,7 @@ namespace Microsoft.Agents.AI.UnitTests.Compaction;
public class SlidingWindowCompactionStrategyTests
{
[Fact]
public async Task CompactAsync_BelowMaxTurns_ReturnsFalseAsync()
public async Task CompactAsyncBelowMaxTurnsReturnsFalseAsync()
{
// Arrange
SlidingWindowCompactionStrategy strategy = new(maximumTurns: 3);
@@ -33,7 +33,7 @@ public class SlidingWindowCompactionStrategyTests
}
[Fact]
public async Task CompactAsync_ExceedsMaxTurns_ExcludesOldestTurnsAsync()
public async Task CompactAsyncExceedsMaxTurnsExcludesOldestTurnsAsync()
{
// Arrange — keep 2 turns, conversation has 3
SlidingWindowCompactionStrategy strategy = new(maximumTurns: 2);
@@ -63,7 +63,7 @@ public class SlidingWindowCompactionStrategyTests
}
[Fact]
public async Task CompactAsync_PreservesSystemMessagesAsync()
public async Task CompactAsyncPreservesSystemMessagesAsync()
{
// Arrange
SlidingWindowCompactionStrategy strategy = new(maximumTurns: 1);
@@ -87,7 +87,7 @@ public class SlidingWindowCompactionStrategyTests
}
[Fact]
public async Task CompactAsync_PreservesToolCallGroupsInKeptTurnsAsync()
public async Task CompactAsyncPreservesToolCallGroupsInKeptTurnsAsync()
{
// Arrange
SlidingWindowCompactionStrategy strategy = new(maximumTurns: 1);
@@ -114,7 +114,7 @@ public class SlidingWindowCompactionStrategyTests
}
[Fact]
public async Task CompactAsync_CustomTrigger_OverridesDefaultAsync()
public async Task CompactAsyncCustomTriggerOverridesDefaultAsync()
{
// Arrange — custom trigger: only compact when tokens exceed threshold
SlidingWindowCompactionStrategy strategy = new(maximumTurns: 99);
@@ -134,7 +134,7 @@ public class SlidingWindowCompactionStrategyTests
}
[Fact]
public async Task CompactAsync_IncludedMessages_ContainOnlyKeptTurnsAsync()
public async Task CompactAsyncIncludedMessagesContainOnlyKeptTurnsAsync()
{
// Arrange
SlidingWindowCompactionStrategy strategy = new(maximumTurns: 1);
@@ -14,7 +14,7 @@ namespace Microsoft.Agents.AI.UnitTests.Compaction;
public class ToolResultCompactionStrategyTests
{
[Fact]
public async Task CompactAsync_TriggerNotMet_ReturnsFalseAsync()
public async Task CompactAsyncTriggerNotMetReturnsFalseAsync()
{
// Arrange — trigger requires > 1000 tokens
ToolResultCompactionStrategy strategy = new(CompactionTriggers.TokensExceed(1000));
@@ -37,7 +37,7 @@ public class ToolResultCompactionStrategyTests
}
[Fact]
public async Task CompactAsync_CollapsesOldToolGroupsAsync()
public async Task CompactAsyncCollapsesOldToolGroupsAsync()
{
// Arrange — always trigger
ToolResultCompactionStrategy strategy = new(
@@ -67,7 +67,7 @@ public class ToolResultCompactionStrategyTests
}
[Fact]
public async Task CompactAsync_PreservesRecentToolGroupsAsync()
public async Task CompactAsyncPreservesRecentToolGroupsAsync()
{
// Arrange — protect 2 recent non-system groups (the tool group + Q2)
ToolResultCompactionStrategy strategy = new(
@@ -90,7 +90,7 @@ public class ToolResultCompactionStrategyTests
}
[Fact]
public async Task CompactAsync_PreservesSystemMessagesAsync()
public async Task CompactAsyncPreservesSystemMessagesAsync()
{
// Arrange
ToolResultCompactionStrategy strategy = new(
@@ -115,7 +115,7 @@ public class ToolResultCompactionStrategyTests
}
[Fact]
public async Task CompactAsync_ExtractsMultipleToolNamesAsync()
public async Task CompactAsyncExtractsMultipleToolNamesAsync()
{
// Arrange — assistant calls two tools
ToolResultCompactionStrategy strategy = new(
@@ -148,7 +148,7 @@ public class ToolResultCompactionStrategyTests
}
[Fact]
public async Task CompactAsync_NoToolGroups_ReturnsFalseAsync()
public async Task CompactAsyncNoToolGroupsReturnsFalseAsync()
{
// Arrange — trigger fires but no tool groups to collapse
ToolResultCompactionStrategy strategy = new(
@@ -169,7 +169,7 @@ public class ToolResultCompactionStrategyTests
}
[Fact]
public async Task CompactAsync_CompoundTrigger_RequiresTokensAndToolCallsAsync()
public async Task CompactAsyncCompoundTriggerRequiresTokensAndToolCallsAsync()
{
// Arrange — compound: tokens > 0 AND has tool calls
ToolResultCompactionStrategy strategy = new(
@@ -15,7 +15,7 @@ public class TruncationCompactionStrategyTests
private static readonly CompactionTrigger s_alwaysTrigger = _ => true;
[Fact]
public async Task CompactAsync_AlwaysTrigger_CompactsToPreserveRecentAsync()
public async Task CompactAsyncAlwaysTriggerCompactsToPreserveRecentAsync()
{
// Arrange — always-trigger means always compact
TruncationCompactionStrategy strategy = new(s_alwaysTrigger, preserveRecentGroups: 1);
@@ -35,7 +35,7 @@ public class TruncationCompactionStrategyTests
}
[Fact]
public async Task CompactAsync_TriggerNotMet_ReturnsFalseAsync()
public async Task CompactAsyncTriggerNotMetReturnsFalseAsync()
{
// Arrange — trigger requires > 1000 tokens, conversation is tiny
TruncationCompactionStrategy strategy = new(
@@ -57,7 +57,7 @@ public class TruncationCompactionStrategyTests
}
[Fact]
public async Task CompactAsync_TriggerMet_ExcludesOldestGroupsAsync()
public async Task CompactAsyncTriggerMetExcludesOldestGroupsAsync()
{
// Arrange — trigger on groups > 2
TruncationCompactionStrategy strategy = new(
@@ -86,7 +86,7 @@ public class TruncationCompactionStrategyTests
}
[Fact]
public async Task CompactAsync_PreservesSystemMessagesAsync()
public async Task CompactAsyncPreservesSystemMessagesAsync()
{
// Arrange
TruncationCompactionStrategy strategy = new(s_alwaysTrigger, preserveRecentGroups: 1);
@@ -114,7 +114,7 @@ public class TruncationCompactionStrategyTests
}
[Fact]
public async Task CompactAsync_PreservesToolCallGroupAtomicityAsync()
public async Task CompactAsyncPreservesToolCallGroupAtomicityAsync()
{
// Arrange
TruncationCompactionStrategy strategy = new(s_alwaysTrigger, preserveRecentGroups: 1);
@@ -138,7 +138,7 @@ public class TruncationCompactionStrategyTests
}
[Fact]
public async Task CompactAsync_SetsExcludeReasonAsync()
public async Task CompactAsyncSetsExcludeReasonAsync()
{
// Arrange
TruncationCompactionStrategy strategy = new(s_alwaysTrigger, preserveRecentGroups: 1);
@@ -157,7 +157,7 @@ public class TruncationCompactionStrategyTests
}
[Fact]
public async Task CompactAsync_SkipsAlreadyExcludedGroupsAsync()
public async Task CompactAsyncSkipsAlreadyExcludedGroupsAsync()
{
// Arrange
TruncationCompactionStrategy strategy = new(s_alwaysTrigger, preserveRecentGroups: 1);
@@ -180,7 +180,7 @@ public class TruncationCompactionStrategyTests
}
[Fact]
public async Task CompactAsync_PreserveRecentGroups_KeepsMultipleAsync()
public async Task CompactAsyncPreserveRecentGroupsKeepsMultipleAsync()
{
// Arrange — keep 2 most recent
TruncationCompactionStrategy strategy = new(s_alwaysTrigger, preserveRecentGroups: 2);
@@ -204,7 +204,7 @@ public class TruncationCompactionStrategyTests
}
[Fact]
public async Task CompactAsync_NothingToRemove_ReturnsFalseAsync()
public async Task CompactAsyncNothingToRemoveReturnsFalseAsync()
{
// Arrange — preserve 5 but only 2 groups
TruncationCompactionStrategy strategy = new(s_alwaysTrigger, preserveRecentGroups: 5);