Repository navigation
fix(gateway): skip auto-restart for webhook channels that resolve immediately - #23134
puneet1409 wants to merge 1 commit into
Conversation
…ediately Webhook-based channels like Google Chat register an HTTP route on the shared gateway server and resolve their startAccount promise immediately. The auto-restart logic added in v2026.2.17 triggers on any promise settlement (including successful resolution), causing these channels to enter an infinite restart loop. Track whether the task promise rejected and only auto-restart on error exit. Channels that resolve cleanly are not crashed and do not need restart. Fixes openclaw#23114 Co-Authored-By: Claude Opus 4.6 <[email protected]>
| // Only auto-restart channels that crashed. Webhook-based channels | ||
| // (e.g. Google Chat) resolve immediately after registering their | ||
| // HTTP route — restarting those causes an infinite restart loop. | ||
| if (!didError) { | ||
| return; | ||
| } |
There was a problem hiding this comment.
The comment mentions BlueBubbles as an example webhook channel that resolves immediately, but code analysis shows monitorBlueBubblesProvider returns a Promise that only resolves when aborted (see extensions/bluebubbles/src/monitor.ts:516-531). BlueBubbles behaves like a polling channel, not a webhook channel that resolves immediately. Consider updating the comment to only mention Google Chat, or clarify which specific webhook channels this applies to.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/gateway/server-channels.ts
Line: 219-224
Comment:
The comment mentions BlueBubbles as an example webhook channel that resolves immediately, but code analysis shows `monitorBlueBubblesProvider` returns a Promise that only resolves when aborted (see extensions/bluebubbles/src/monitor.ts:516-531). BlueBubbles behaves like a polling channel, not a webhook channel that resolves immediately. Consider updating the comment to only mention Google Chat, or clarify which specific webhook channels this applies to.
How can I resolve this? If you propose a fix, please make it concise.|
This pull request has been automatically marked as stale due to inactivity. |
|
Closing due to inactivity. |
Summary
Problem
The channel auto-restart hardening in v2026.2.17 wraps channel task promises with
.then(autoRestart). This fires when the promise resolves, not just when it rejects.Polling channels (Telegram, Discord, Slack) return long-lived promises that stay pending — their event loop runs forever. The
.then()only fires when they crash.Webhook channels (Google Chat, BlueBubbles) register an HTTP route on the shared gateway server and resolve immediately — there is no long-running loop. The
.then()fires right after startup, triggering an infinite restart cycle:Fix
Add a
didErrorflag set in the.catch()handler. The.then()auto-restart handler checks this flag and returns early if the channel exited cleanly (no error). This preserves crash-loop recovery for polling channels while preventing spurious restarts for webhook channels.Bisect
Test plan
startAccount(simulates actual crash)startAccountvitest run src/gateway/server-channels.test.ts)Fixes #23114
🤖 Generated with Claude Code
Greptile Summary
Fixes infinite restart loop for webhook-based channels (specifically Google Chat) by tracking whether the channel task promise rejected before attempting auto-restart. The fix adds a
didErrorflag that is set in the.catch()handler, and the.then()auto-restart handler checks this flag to skip restarting channels that exited cleanly. This preserves crash-loop recovery for long-running polling channels while preventing spurious restarts for webhook channels that resolve immediately after registering their HTTP route.Confidence Score: 5/5
Last reviewed commit: c547db1
(2/5) Greptile learns from your feedback when you react with thumbs up/down!