-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
Discord plugin does not auto-reconnect after 1006 WS close (forces full gateway restart, kills in-flight turns) #99681
Copy link
Copy link
Closed
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.Crash, hang, restart loop, or process-level availability failure.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.maturity:stableIssue affects a taxonomy feature currently scored M4/M5.Issue affects a taxonomy feature currently scored M4/M5.
Description
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.Crash, hang, restart loop, or process-level availability failure.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.maturity:stableIssue affects a taxonomy feature currently scored M4/M5.Issue affects a taxonomy feature currently scored M4/M5.
Type
Fields
Priority
None yet
Summary
Discord routinely closes the bot gateway WebSocket with code 1006 (abnormal, empty reason) — normal server-side rebalancing that every long-lived bot sees. After such a close, the
@openclaw/discordplugin does not re-establish the connection on its own (no successful RESUME / re-IDENTIFY, no recovery markers) for minutes. The connection only comes back when the entire gateway process is restarted. Because a full gateway restart interrupts whatever agent turns are mid-execution, this causes user-facing message loss: a user asks an agent something in Discord, the turn is running, the gateway restarts to recover Discord, and the turn dies with no reply.Steps to reproduce
reason=<empty>) — happens ~4–8×/day for any long-lived bot; it is server-initiated, not an auth/intent 4xxx close.starting provider/channels resolvedmarkers appear.Expected behavior
On a 1006/1005 close, the plugin should RESUME (or re-IDENTIFY) and reconnect its own WebSocket within seconds, without requiring a gateway process restart — standard Discord gateway client behavior. A transient WS close should never require a full-process restart.
Actual behavior
The plugin goes silent after the close. Two full episodes from
gateway.log— nothing happens between the close and the (external) full gateway restart:Same shape at 10:31:46 close → 10:34:20 restart. A single
auto-restart attempt N/10is logged per close but never re-establishes; recovery attempts sometimes fail withWebSocket was closed before the connection was established.OpenClaw version
2026.6.10 (aa69b12);
@openclaw/discordplugin 2026.6.10Operating system
macOS (Darwin 24.6.0), Apple Silicon Mac mini, wired Ethernet
Install method
npm global (
/usr/local/lib/node_modules/openclaw)Model / Provider / routing chain
Not applicable — this is a channel-transport (Discord gateway) reliability bug, independent of model/provider.
Logs
Gateway websocket closedevents in the current log: 127× code 1006, 98× code 1005, allreason=<empty>/reasonBytes=0(server-initiated transport closes).Impact and severity
High — user-facing message loss. Full-gateway restarts (2–6×/day) interrupt in-flight interactive agent turns; the user gets silence and must re-ask. The gateway itself logs the interruption (
main-session-restart-recovery: resumed interrupted main session).Additional information
Ruled out (so this isn't a local-environment red herring):
pmset sleep 0,powernap 0, no Sleep/Wake events at close times.No turn-safe recovery is exposed today (verified 2026-07-03):
openclaw channels login --channel discord→Error: Channel "discord" does not support login.openclaw channels capabilities --channel discordActions =send, broadcast, poll, react, …, channel-*, set-presence— no reconnect / restart / reload verb.Secondary ask: if fixing the plugin's auto-reconnect is non-trivial, please expose a turn-safe, channel-scoped reconnect (CLI/RPC to restart just the Discord provider connection) so operators can recover Discord without restarting the gateway and killing agent turns.
Happy to supply fuller
gateway.logexcerpts or run diagnostics.