Skip to content

fix: cap Discord gateway reconnect at 50 attempts to prevent infinite loop - #12230

Merged
thewilloftheshadow merged 2 commits into
openclaw:mainfrom
Yida-Dev:fix/discord-reconnect-max-attempts
Feb 10, 2026
Merged

thewilloftheshadow merged 2 commits into
openclaw:mainfrom
Yida-Dev:fix/discord-reconnect-max-attempts

Conversation

@Yida-Dev

@Yida-Dev Yida-Dev commented Feb 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Discord GatewayPlugin was configured with maxAttempts: Number.POSITIVE_INFINITY, allowing unbounded reconnection loops
  • When the Discord gateway enters a persistent failure state (e.g. WebSocket close code 1005 with stalled HELLO), the provider reconnects every ~30 seconds indefinitely
  • User reported 2,483 reconnection attempts in one log file, starving the event loop and blocking cron, heartbeat, and other channels
  • Changed maxAttempts from Infinity to 50, providing ~25 minutes of retry time before cleanly exiting via the existing shouldStopOnError handler that checks for "Max reconnect attempts"

Test plan

  • All 176 Discord tests pass (23 test files)
  • The existing shouldStopOnError handler (line 659) already handles the "Max reconnect attempts" error message that Carbon emits when the limit is reached

Closes #11836

Co-Authored-By: Claude Opus 4.6 [email protected]

Greptile Overview

Greptile Summary

This change updates the Discord GatewayPlugin reconnect configuration in src/discord/monitor/provider.ts by capping reconnect.maxAttempts from Number.POSITIVE_INFINITY to 50. The intent is to prevent unbounded reconnect loops when the Discord gateway is in a persistent failure/zombie state, letting the existing shouldStopOnError handler (which stops on the "Max reconnect attempts" error message) terminate the monitor cleanly after a finite retry window.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk.
  • The change is a single, localized config adjustment (Infinity -> 50) that prevents an infinite reconnect loop without altering control flow elsewhere, and it leverages existing stop-on-error handling already present in the provider. No additional code paths or interfaces are introduced.
  • No files require special attention

@openclaw-barnacle openclaw-barnacle Bot added the channel: discord Channel integration: discord label Feb 9, 2026
@thewilloftheshadow thewilloftheshadow self-assigned this Feb 10, 2026
Yida-Dev and others added 2 commits February 9, 2026 20:31
The Discord GatewayPlugin was configured with maxAttempts: Infinity,
which causes an unbounded reconnection loop when the Discord gateway
enters a persistent failure state (e.g. code 1005 with stalled HELLO).

In production, this manifested as 2,483+ reconnection attempts in a
single log file, starving the Node.js event loop and preventing cron,
heartbeat, and other subsystems from functioning.

Cap maxAttempts at 50, which provides ~25 minutes of retry time
(with 30s HELLO timeout between attempts) before cleanly exiting
via the existing "Max reconnect attempts" error handler.

Closes openclaw#11836

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@thewilloftheshadow
thewilloftheshadow force-pushed the fix/discord-reconnect-max-attempts branch from dc32c70 to 3bebc3f Compare February 10, 2026 02:36
@thewilloftheshadow
thewilloftheshadow merged commit d3c7187 into openclaw:main Feb 10, 2026
10 checks passed
@thewilloftheshadow

Copy link
Copy Markdown
Member

Landed via temp rebase onto main.

  • Related tests: pnpm vitest run --config vitest.unit.config.ts src/discord/gateway-logging.test.ts
  • Land commit: 3bebc3f
  • Merge commit: d3c7187

Thanks @Yida-Dev!

lucasmpramos pushed a commit to butley/openclaw that referenced this pull request Feb 10, 2026
… loop (openclaw#12230)

* fix: cap Discord gateway reconnect attempts to prevent infinite loop

The Discord GatewayPlugin was configured with maxAttempts: Infinity,
which causes an unbounded reconnection loop when the Discord gateway
enters a persistent failure state (e.g. code 1005 with stalled HELLO).

In production, this manifested as 2,483+ reconnection attempts in a
single log file, starving the Node.js event loop and preventing cron,
heartbeat, and other subsystems from functioning.

Cap maxAttempts at 50, which provides ~25 minutes of retry time
(with 30s HELLO timeout between attempts) before cleanly exiting
via the existing "Max reconnect attempts" error handler.

Closes openclaw#11836

Co-Authored-By: Claude Opus 4.6 <[email protected]>

* Changelog: note Discord gateway reconnect cap (openclaw#12230) (thanks @Yida-Dev)

---------

Co-authored-by: Yida-Dev <[email protected]>
Co-authored-by: Claude Opus 4.6 <[email protected]>
Co-authored-by: Shadow <[email protected]>
ProgramCaiCai pushed a commit to ProgramCaiCai/openclaw that referenced this pull request Feb 10, 2026
… loop (openclaw#12230)

* fix: cap Discord gateway reconnect attempts to prevent infinite loop

The Discord GatewayPlugin was configured with maxAttempts: Infinity,
which causes an unbounded reconnection loop when the Discord gateway
enters a persistent failure state (e.g. code 1005 with stalled HELLO).

In production, this manifested as 2,483+ reconnection attempts in a
single log file, starving the Node.js event loop and preventing cron,
heartbeat, and other subsystems from functioning.

Cap maxAttempts at 50, which provides ~25 minutes of retry time
(with 30s HELLO timeout between attempts) before cleanly exiting
via the existing "Max reconnect attempts" error handler.

Closes openclaw#11836

Co-Authored-By: Claude Opus 4.6 <[email protected]>

* Changelog: note Discord gateway reconnect cap (openclaw#12230) (thanks @Yida-Dev)

---------

Co-authored-by: Yida-Dev <[email protected]>
Co-authored-by: Claude Opus 4.6 <[email protected]>
Co-authored-by: Shadow <[email protected]>
skyhawk14 pushed a commit to skyhawk14/openclaw that referenced this pull request Feb 13, 2026
… loop (openclaw#12230)

* fix: cap Discord gateway reconnect attempts to prevent infinite loop

The Discord GatewayPlugin was configured with maxAttempts: Infinity,
which causes an unbounded reconnection loop when the Discord gateway
enters a persistent failure state (e.g. code 1005 with stalled HELLO).

In production, this manifested as 2,483+ reconnection attempts in a
single log file, starving the Node.js event loop and preventing cron,
heartbeat, and other subsystems from functioning.

Cap maxAttempts at 50, which provides ~25 minutes of retry time
(with 30s HELLO timeout between attempts) before cleanly exiting
via the existing "Max reconnect attempts" error handler.

Closes openclaw#11836

Co-Authored-By: Claude Opus 4.6 <[email protected]>

* Changelog: note Discord gateway reconnect cap (openclaw#12230) (thanks @Yida-Dev)

---------

Co-authored-by: Yida-Dev <[email protected]>
Co-authored-by: Claude Opus 4.6 <[email protected]>
Co-authored-by: Shadow <[email protected]>
john-ver pushed a commit to apmcoin/apmclaw that referenced this pull request Mar 9, 2026
dustin-olenslager pushed a commit to dustin-olenslager/ironclaw-supreme that referenced this pull request Mar 24, 2026
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
… loop (openclaw#12230)

* fix: cap Discord gateway reconnect attempts to prevent infinite loop

The Discord GatewayPlugin was configured with maxAttempts: Infinity,
which causes an unbounded reconnection loop when the Discord gateway
enters a persistent failure state (e.g. code 1005 with stalled HELLO).

In production, this manifested as 2,483+ reconnection attempts in a
single log file, starving the Node.js event loop and preventing cron,
heartbeat, and other subsystems from functioning.

Cap maxAttempts at 50, which provides ~25 minutes of retry time
(with 30s HELLO timeout between attempts) before cleanly exiting
via the existing "Max reconnect attempts" error handler.

Closes openclaw#11836

Co-Authored-By: Claude Opus 4.6 <[email protected]>

* Changelog: note Discord gateway reconnect cap (openclaw#12230) (thanks @Yida-Dev)

---------

Co-authored-by: Yida-Dev <[email protected]>
Co-authored-by: Claude Opus 4.6 <[email protected]>
Co-authored-by: Shadow <[email protected]>
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
… loop (openclaw#12230)

* fix: cap Discord gateway reconnect attempts to prevent infinite loop

The Discord GatewayPlugin was configured with maxAttempts: Infinity,
which causes an unbounded reconnection loop when the Discord gateway
enters a persistent failure state (e.g. code 1005 with stalled HELLO).

In production, this manifested as 2,483+ reconnection attempts in a
single log file, starving the Node.js event loop and preventing cron,
heartbeat, and other subsystems from functioning.

Cap maxAttempts at 50, which provides ~25 minutes of retry time
(with 30s HELLO timeout between attempts) before cleanly exiting
via the existing "Max reconnect attempts" error handler.

Closes openclaw#11836

Co-Authored-By: Claude Opus 4.6 <[email protected]>

* Changelog: note Discord gateway reconnect cap (openclaw#12230) (thanks @Yida-Dev)

---------

Co-authored-by: Yida-Dev <[email protected]>
Co-authored-by: Claude Opus 4.6 <[email protected]>
Co-authored-by: Shadow <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
… loop (openclaw#12230)

* fix: cap Discord gateway reconnect attempts to prevent infinite loop

The Discord GatewayPlugin was configured with maxAttempts: Infinity,
which causes an unbounded reconnection loop when the Discord gateway
enters a persistent failure state (e.g. code 1005 with stalled HELLO).

In production, this manifested as 2,483+ reconnection attempts in a
single log file, starving the Node.js event loop and preventing cron,
heartbeat, and other subsystems from functioning.

Cap maxAttempts at 50, which provides ~25 minutes of retry time
(with 30s HELLO timeout between attempts) before cleanly exiting
via the existing "Max reconnect attempts" error handler.

Closes openclaw#11836

Co-Authored-By: Claude Opus 4.6 <[email protected]>

* Changelog: note Discord gateway reconnect cap (openclaw#12230) (thanks @Yida-Dev)

---------

Co-authored-by: Yida-Dev <[email protected]>
Co-authored-by: Claude Opus 4.6 <[email protected]>
Co-authored-by: Shadow <[email protected]>
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
lhfer pushed a commit to lhfer/openclaw that referenced this pull request Oct 11, 2026
… loop (openclaw#12230)

* fix: cap Discord gateway reconnect attempts to prevent infinite loop

The Discord GatewayPlugin was configured with maxAttempts: Infinity,
which causes an unbounded reconnection loop when the Discord gateway
enters a persistent failure state (e.g. code 1005 with stalled HELLO).

In production, this manifested as 2,483+ reconnection attempts in a
single log file, starving the Node.js event loop and preventing cron,
heartbeat, and other subsystems from functioning.

Cap maxAttempts at 50, which provides ~25 minutes of retry time
(with 30s HELLO timeout between attempts) before cleanly exiting
via the existing "Max reconnect attempts" error handler.

Closes openclaw#11836

Co-Authored-By: Claude Opus 4.6 <[email protected]>

* Changelog: note Discord gateway reconnect cap (openclaw#12230) (thanks @Yida-Dev)

---------

Co-authored-by: Yida-Dev <[email protected]>
Co-authored-by: Claude Opus 4.6 <[email protected]>
Co-authored-by: Shadow <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: discord Channel integration: discord

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Discord gateway enters infinite reconnection loop (code 1005) without recovery

2 participants