From eb6fa0dacfb35e3d58efd42bfe07a0dd897ad4a2 Mon Sep 17 00:00:00 2001 From: Chang Shu-Huai Date: Thu, 26 Feb 2026 09:01:02 +0000 Subject: [PATCH] fix(googlechat): keep startAccount pending until abort to prevent restart loop --- extensions/googlechat/src/channel.ts | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/extensions/googlechat/src/channel.ts b/extensions/googlechat/src/channel.ts index 52943f63049..0233cac7017 100644 --- a/extensions/googlechat/src/channel.ts +++ b/extensions/googlechat/src/channel.ts @@ -563,14 +563,20 @@ export const googlechatPlugin: ChannelPlugin = { webhookUrl: account.config.webhookUrl, statusSink: (patch) => ctx.setStatus({ accountId: account.accountId, ...patch }), }); - return () => { - unregister?.(); - ctx.setStatus({ - accountId: account.accountId, - running: false, - lastStopAt: Date.now(), - }); - }; + // Keep the promise pending until abort (webhook mode is passive). + await new Promise((resolve) => { + if (ctx.abortSignal.aborted) { + resolve(); + return; + } + ctx.abortSignal.addEventListener("abort", () => resolve(), { once: true }); + }); + unregister?.(); + ctx.setStatus({ + accountId: account.accountId, + running: false, + lastStopAt: Date.now(), + }); }, }, };