Skip to content

Commit 459ea0c

Browse files
committed
test(compaction): cover custom memory flush headroom
1 parent e6fbc92 commit 459ea0c

1 file changed

Lines changed: 19 additions & 6 deletions

File tree

‎src/auto-reply/reply/agent-runner-memory.test.ts‎

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -547,13 +547,26 @@ describe("runMemoryFlushIfNeeded", () => {
547547
});
548548

549549
it.each([
550-
[8_767, false, false],
551-
[8_768, true, false],
552-
[12_767, true, false],
553-
[12_768, true, true],
550+
["default", 8_767, false, false],
551+
["default", 8_768, true, false],
552+
["default", 12_767, true, false],
553+
["default", 12_768, true, true],
554+
["custom", 18_767, false, false],
555+
["custom", 18_768, true, false],
556+
["custom", 20_767, true, false],
557+
["custom", 20_768, true, true],
554558
] as const)(
555-
"separates early flush and blocking compaction at %i tokens",
556-
async (totalTokens, flushExpected, compactionExpected) => {
559+
"separates early flush and blocking compaction for %s plan at %i tokens",
560+
async (plan, totalTokens, flushExpected, compactionExpected) => {
561+
if (plan === "custom") {
562+
registerMemoryCapability("third-party-memory", {
563+
flushPlanResolver: () =>
564+
createModifiedMemoryFlushPlan({
565+
reserveTokensFloor: 12_000,
566+
softThresholdTokens: 2_000,
567+
}),
568+
});
569+
}
557570
const entry = createFlushSessionEntry({ totalTokens, compactionCount: 0 });
558571
const storePath = path.join(rootDir, "sessions.json");
559572
await writeTestSessionStore(storePath, "main", entry);

0 commit comments

Comments
 (0)