Skip to content

Commit 31a0f97

Browse files
openclaw-clownfish[bot]obviyus
authored andcommitted
fix(clownfish): repair validation for repair-94016-live-pr-inventory-20260617t082059-003-20260617a (2)
1 parent ace22fe commit 31a0f97

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/gateway/server-channels.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -570,8 +570,6 @@ export function createChannelManager(opts: ChannelManagerOptions): ChannelManage
570570
return;
571571
}
572572

573-
let trackedPromise: Promise<unknown>;
574-
const isCurrentTask = () => store.tasks.get(id) === trackedPromise;
575573
scopedChannelRuntime = await measureStartup(`channels.${channelId}.runtime`, async () =>
576574
createTaskScopedChannelRuntime({
577575
channelRuntime: await getChannelRuntime(),
@@ -648,7 +646,7 @@ export function createChannelManager(opts: ChannelManagerOptions): ChannelManage
648646
});
649647
// Recovery can replace a timed-out task before the old promise settles.
650648
// Only the task that still owns the store slot may write lifecycle state.
651-
trackedPromise = task
649+
const trackedPromise = task
652650
.then(() => {
653651
if (abort.signal.aborted || manuallyStopped.has(rKey) || !isCurrentTask()) {
654652
return;
@@ -768,6 +766,9 @@ export function createChannelManager(opts: ChannelManagerOptions): ChannelManage
768766
store.aborts.delete(id);
769767
}
770768
});
769+
function isCurrentTask() {
770+
return store.tasks.get(id) === trackedPromise;
771+
}
771772
handedOffTask = true;
772773
store.tasks.set(id, trackedPromise);
773774
} catch (error) {

0 commit comments

Comments
 (0)