Google Chat webhook 通道重启风暴:用 abort 挂起修复被误判“已停止”
问题/场景:Google Chat webhook 为事件驱动,无轮询主循环,startAccount 返回过快被框架误判 stopped,触发无限重启。前置条件:启用 Google Chat channel,版本含健康监控重启逻辑。实施步骤:复现启动后 10 次指数退避重启 → 在 startAccount 中让流程挂起直到 abortSignal 触发 → 保留 cleanup 回调释放 monitor → 冷启动验证无重复重启。关键代码:await new Promise(resolve=>ctx.abortSignal.addEventListener('abort', resolve,{once:true})). 验证:日志只出现一次 account started,且不再循环 restart。风险:若未正确处理 abort,停机时可能泄漏监听器。来源:Issue #21045。
GITHUBDiscovered 2026-02-20Author jorgenscheel
Prerequisites
- Google Chat channel is configured in webhook/passive monitor mode.
- You can inspect gateway startup logs and modify extension channel.ts safely.
Steps
- Reproduce the issue and confirm repeated auto-restart attempts after startAccount returns.
- Patch startAccount to await an abort-gated Promise so account lifecycle remains active.
- Keep cleanup logic to stop monitor and release handlers when abort fires.
- Restart gateway and verify startup remains stable without exponential backoff loops.
Commands
openclaw gateway restartopenclaw gateway statusVerify
Google Chat account starts once and remains healthy; no repeated stop/restart messages in logs.
Caveats
- This pattern is for passive webhook channels; do not apply blindly to polling channels.
- If monitor startup throws before Promise wiring, loop may persist(需验证).
Source attribution
This tip is aggregated from community/public sources and preserved with attribution.
Open original source ↗