Skip to content

fix(gateway): skip auto-restart for webhook channels that resolve immediately - #23134

Closed
puneet1409 wants to merge 1 commit into
openclaw:mainfrom
puneet1409:fix/webhook-channel-auto-restart-loop
Closed

puneet1409 wants to merge 1 commit into
openclaw:mainfrom
puneet1409:fix/webhook-channel-auto-restart-loop

Conversation

@puneet1409

@puneet1409 puneet1409 commented Feb 22, 2026 •

Copy link
Copy Markdown

Summary

  • Fix infinite auto-restart loop for webhook-based channels (Google Chat, BlueBubbles) introduced in v2026.2.17
  • Track whether the channel task promise rejected and only auto-restart on error exit
  • Channels that resolve cleanly (webhook route registered successfully) are not restarted

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:

[googlechat] [fretron] starting Google Chat webhook
[googlechat] [fretron] auto-restart attempt 1/10 in 5s
[googlechat] [fretron] starting Google Chat webhook
[googlechat] [fretron] auto-restart attempt 2/10 in 10s
...

Fix

Add a didError flag 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

Version Status
2026.2.14 OK
2026.2.15 OK (last good)
2026.2.17 BROKEN (first bad)
2026.2.19+ BROKEN

Test plan

  • Updated crash-loop test to use a throwing startAccount (simulates actual crash)
  • Updated manual-stop test to use a throwing startAccount
  • Added new test: webhook channel that resolves immediately is NOT restarted
  • Existing tests pass (vitest 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 didError flag 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

  • This PR is safe to merge with minimal risk
  • The fix is simple, well-tested, and directly addresses the root cause. The logic correctly distinguishes between clean exits and error exits using a boolean flag. Test coverage includes the new webhook behavior plus updated tests for crash-loop scenarios. The only minor issue is an inaccurate example in a code comment.
  • No files require special attention

Last reviewed commit: c547db1

(2/5) Greptile learns from your feedback when you react with thumbs up/down!

…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]>
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: XS labels Feb 22, 2026

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment on lines +219 to +224
// 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;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Feb 28, 2026
@openclaw-barnacle

Copy link
Copy Markdown

Closing due to inactivity.
If you believe this PR should be revived, post in #pr-thunderdome-dangerzone on Discord to talk to a maintainer.
That channel is the escape hatch for high-quality PRs that get auto-closed.

@openclaw-barnacle openclaw-barnacle Bot closed this Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime size: XS stale Marked as stale due to inactivity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Google Chat webhook: silent auto-restart loop regression in v2026.2.15+

1 participant