openclaw - 💡(How to fix) Fix Discord channel: stale-socket health-monitor restarts every 6 min on quiet guilds [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#70352Fetched 2026-04-23 07:25:49
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Author
Participants

In a low-traffic Discord guild, the channel health monitor restarts the Discord client every ~6 min on a clockwork cadence, even though the bot is connected and functional. Cause: channelHealthCheckMinutes: 1 + channelStaleEventThresholdMinutes: 5

  • no Discord events arriving from the guild within 5 min ⇒ stale-socket false positive.

Root Cause

Root cause hypothesis

Fix Action

Fix / Workaround

Either:

  1. Count WS heartbeat acks toward the freshness clock (most correct), OR
  2. Increase the default channelStaleEventThresholdMinutes from 5 to 30+ minutes, OR
  3. Document that quiet guilds should raise channelStaleEventThresholdMinutes (we set ours to 60 as a workaround, eliminating the loop)

Workaround applied locally

Code Example

"gateway": {
    "channelHealthCheckMinutes": 1,
    "channelStaleEventThresholdMinutes": 5
  }

---

2026-04-22T03:21:27 ready (6 plugins: ...; 15.7s)
2026-04-22T03:21:30 discord client initialized as ... (Open-claw); awaiting gateway readiness
2026-04-22T03:27:27 [discord:default] health-monitor: restarting (reason: stale-socket)
2026-04-22T03:33:27 [discord:default] health-monitor: restarting (reason: stale-socket)
...

---

jq '.gateway.channelStaleEventThresholdMinutes = 60' \
  ~/.openclaw/openclaw.json > /tmp/new && mv /tmp/new ~/.openclaw/openclaw.json
supervisorctl restart openclaw-gateway
RAW_BUFFERClick to expand / collapse

Discord channel: stale-socket health-monitor restarts every 6 min on quiet guilds

openclaw version: 2026.4.20 (commit 115f05d) Pre-existing in: 2026.4.15 and earlier (pre-#43392 fix) #43392 fix: "delay HTTP bind until websocket handlers attached" — does NOT resolve this symptom

Summary

In a low-traffic Discord guild, the channel health monitor restarts the Discord client every ~6 min on a clockwork cadence, even though the bot is connected and functional. Cause: channelHealthCheckMinutes: 1 + channelStaleEventThresholdMinutes: 5

  • no Discord events arriving from the guild within 5 min ⇒ stale-socket false positive.

Reproduction

  • Single small Discord guild (~1 channel, low message volume)
  • Default config:
    "gateway": {
      "channelHealthCheckMinutes": 1,
      "channelStaleEventThresholdMinutes": 5
    }
  • Bot has correct intents enabled (Message Content Intent verified ON in dev portal)
  • After bot connects, watch /tmp/openclaw/openclaw-YYYY-MM-DD.log

Observed cadence

2026-04-22T03:21:27 ready (6 plugins: ...; 15.7s)
2026-04-22T03:21:30 discord client initialized as ... (Open-claw); awaiting gateway readiness
2026-04-22T03:27:27 [discord:default] health-monitor: restarting (reason: stale-socket)
2026-04-22T03:33:27 [discord:default] health-monitor: restarting (reason: stale-socket)
...

Exactly 6 min between each restart (= 1 min health-check + 5 min stale threshold). Bot remains functional between restarts (messages send/receive correctly), but each restart cycles the entire plugin subsystem, triggering re-init of all extension plugins (Sendblue, semantic-memory, openclaw-web-search). On our system this also triggers harmless EADDRINUSE errors as Sendblue tries to re-bind port 3141 each cycle.

Root cause hypothesis

The health monitor counts only "Discord events" (messages, reactions, etc.) toward "socket alive" tracking. Discord's WS heartbeats and READY/RESUMED frames don't count toward the staleness clock, so any guild with <1 event per 5 min triggers false-positive restarts.

Suggested fix

Either:

  1. Count WS heartbeat acks toward the freshness clock (most correct), OR
  2. Increase the default channelStaleEventThresholdMinutes from 5 to 30+ minutes, OR
  3. Document that quiet guilds should raise channelStaleEventThresholdMinutes (we set ours to 60 as a workaround, eliminating the loop)

Workaround applied locally

jq '.gateway.channelStaleEventThresholdMinutes = 60' \
  ~/.openclaw/openclaw.json > /tmp/new && mv /tmp/new ~/.openclaw/openclaw.json
supervisorctl restart openclaw-gateway

Result: no stale-socket restarts in the first hour after applying.

Environment

  • LXC container, Debian 12, Node 22.22.2
  • Single guild (K9's server), single channel (open-claw)
  • Bot ID: 1478931832987844732, name Open-claw
  • Message Content Intent: ON (verified in dev portal)
  • Other channels (Telegram, Sendblue) on same gateway: no equivalent restart loop

extent analysis

TL;DR

Increase the channelStaleEventThresholdMinutes value to a higher number, such as 30 or 60 minutes, to prevent false-positive restarts in quiet Discord guilds.

Guidance

  • Review the current channelStaleEventThresholdMinutes value in your openclaw.json configuration file and consider increasing it to a higher value, such as 30 or 60 minutes, to accommodate quiet guilds with low event volumes.
  • Verify that the bot has the correct intents enabled, including the Message Content Intent, to ensure that it can receive and process events correctly.
  • Monitor the bot's logs after applying the configuration change to ensure that the restart loop is eliminated.
  • Consider implementing a more robust solution, such as counting WS heartbeat acks toward the freshness clock, to prevent false-positive restarts in the long term.

Example

You can update the channelStaleEventThresholdMinutes value using the following command:

jq '.gateway.channelStaleEventThresholdMinutes = 60' \
  ~/.openclaw/openclaw.json > /tmp/new && mv /tmp/new ~/.openclaw/openclaw.json

Then, restart the openclaw-gateway service using:

supervisorctl restart openclaw-gateway

Notes

The suggested fix may not be suitable for all environments, and the optimal value for channelStaleEventThresholdMinutes may vary depending on the specific use case and traffic patterns.

Recommendation

Apply the workaround by increasing the channelStaleEventThresholdMinutes value to a higher number, such as 60 minutes, to prevent false-positive restarts in quiet Discord guilds. This is a simple and effective solution that can be implemented immediately to address the issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Discord channel: stale-socket health-monitor restarts every 6 min on quiet guilds [1 participants]