From 0679167cc763fb32b8abdb832cf31556ddef309e 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 2084eee40..2336225f8 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) {