From 31a0f97dd944e0f4af193d400a652ab75612973b Mon Sep 17 00:00:00 2001 From: "openclaw-clownfish[bot]" <280122609+openclaw-clownfish[bot]@users.noreply.github.com> Date: Wed, 17 Jun 2026 22:07:09 +0000 Subject: [PATCH] fix(clownfish): repair validation for repair-94016-live-pr-inventory-20260617t082059-003-20260617a (2) --- src/gateway/server-channels.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gateway/server-channels.ts b/src/gateway/server-channels.ts index bf654573a79d..3289f818c78e 100644 --- a/src/gateway/server-channels.ts +++ b/src/gateway/server-channels.ts @@ -570,8 +570,6 @@ export function createChannelManager(opts: ChannelManagerOptions): ChannelManage return; } - let trackedPromise: Promise; - const isCurrentTask = () => store.tasks.get(id) === trackedPromise; scopedChannelRuntime = await measureStartup(`channels.${channelId}.runtime`, async () => createTaskScopedChannelRuntime({ channelRuntime: await getChannelRuntime(), @@ -648,7 +646,7 @@ export function createChannelManager(opts: ChannelManagerOptions): ChannelManage }); // Recovery can replace a timed-out task before the old promise settles. // Only the task that still owns the store slot may write lifecycle state. - trackedPromise = task + const trackedPromise = task .then(() => { if (abort.signal.aborted || manuallyStopped.has(rKey) || !isCurrentTask()) { return; @@ -768,6 +766,9 @@ export function createChannelManager(opts: ChannelManagerOptions): ChannelManage store.aborts.delete(id); } }); + function isCurrentTask() { + return store.tasks.get(id) === trackedPromise; + } handedOffTask = true; store.tasks.set(id, trackedPromise); } catch (error) {