From 412818bbaf71aff7f9729599e6755b53b5ee3b43 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Wed, 11 Mar 2026 19:49:58 -0400 Subject: [PATCH] Reply: share followup drain callback state --- src/auto-reply/reply/queue/drain.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/auto-reply/reply/queue/drain.ts b/src/auto-reply/reply/queue/drain.ts index e8e93b3dd6d..bb77c759c88 100644 --- a/src/auto-reply/reply/queue/drain.ts +++ b/src/auto-reply/reply/queue/drain.ts @@ -15,7 +15,13 @@ import type { FollowupRun } from "./types.js"; // Persists the most recent runFollowup callback per queue key so that // enqueueFollowupRun can restart a drain that finished and deleted the queue. -const FOLLOWUP_RUN_CALLBACKS = new Map Promise>(); +const _g = globalThis as typeof globalThis & { + __openclaw_followup_drain_callbacks__?: Map Promise>; +}; +const FOLLOWUP_RUN_CALLBACKS = (_g.__openclaw_followup_drain_callbacks__ ??= new Map< + string, + (run: FollowupRun) => Promise +>()); export function clearFollowupDrainCallback(key: string): void { FOLLOWUP_RUN_CALLBACKS.delete(key);