From 6ab0f0e1f78351a9313a2bbe313c862c1e81d60d Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Wed, 11 Mar 2026 19:50:06 -0400 Subject: [PATCH] Reply: share queued message dedupe state --- src/auto-reply/reply/queue/enqueue.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/auto-reply/reply/queue/enqueue.ts b/src/auto-reply/reply/queue/enqueue.ts index 7743048a77b..8e4c2d1f3ca 100644 --- a/src/auto-reply/reply/queue/enqueue.ts +++ b/src/auto-reply/reply/queue/enqueue.ts @@ -4,10 +4,17 @@ import { kickFollowupDrainIfIdle } from "./drain.js"; import { getExistingFollowupQueue, getFollowupQueue } from "./state.js"; import type { FollowupRun, QueueDedupeMode, QueueSettings } from "./types.js"; -const RECENT_QUEUE_MESSAGE_IDS = createDedupeCache({ +/** + * Keep queued message-id dedupe shared across bundled chunks so redeliveries + * are rejected no matter which chunk receives the enqueue call. + */ +const _g = globalThis as typeof globalThis & { + __openclaw_recent_queue_message_ids__?: ReturnType; +}; +const RECENT_QUEUE_MESSAGE_IDS = (_g.__openclaw_recent_queue_message_ids__ ??= createDedupeCache({ ttlMs: 5 * 60 * 1000, maxSize: 10_000, -}); +})); function buildRecentMessageIdKey(run: FollowupRun, queueKey: string): string | undefined { const messageId = run.messageId?.trim();