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) {