From 0d30d717e130bbd9e817a772aa58a1bff403dbe1 Mon Sep 17 00:00:00 2001 From: ismeth Date: Fri, 20 Feb 2026 14:19:10 +0100 Subject: [PATCH] fix(agent-switch): correct off-by-one in fallback message cap --- src/hooks/agent-switch/hook.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hooks/agent-switch/hook.ts b/src/hooks/agent-switch/hook.ts index 2084eee4..2336225f 100644 --- a/src/hooks/agent-switch/hook.ts +++ b/src/hooks/agent-switch/hook.ts @@ -114,7 +114,7 @@ export function createAgentSwitchHook(ctx: PluginInput) { processedFallbackMessages.add(marker) // Prevent unbounded growth of the Set - if (processedFallbackMessages.size > MAX_PROCESSED_FALLBACK_MARKERS) { + if (processedFallbackMessages.size >= MAX_PROCESSED_FALLBACK_MARKERS) { const iterator = processedFallbackMessages.values() const oldest = iterator.next().value if (oldest) {