Problem
The WhatsApp channel health monitor restarts the socket when no events arrive for >30 minutes (staleEventThresholdMs defaults to 1,800,000ms). During idle periods (e.g., nighttime), this causes ~38 unnecessary socket restarts per day.
Root Cause
In gateway-cli-*.js, resolveTimingPolicy() falls back to 18e5 (30min) when deps.timing?.staleEventThresholdMs is undefined. The main health monitor call site (startChannelHealthMonitor()) only passes channelManager and checkIntervalMs — no timing object.
Impact
- ~38 restarts/day (1-2/hour), evenly distributed
- 0 message delivery failures observed (restarts are seamless, 2-5s reconnect)
- Cosmetic log noise, unnecessary reconnection churn
Requested Change
Expose staleEventThresholdMs as a configurable option, e.g.:
{
"gateway": {
"channelHealthCheckMinutes": 5,
"channelHealthMonitor": {
"staleEventThresholdMs": 7200000
}
}
}
Suggested default: 2 hours (7,200,000ms) for long-socket channels like WhatsApp.
Environment
- OpenClaw 2026.3.13
- WhatsApp channel (Baileys/WWebJS)
- Ubuntu 24.04 LTS
Problem
The WhatsApp channel health monitor restarts the socket when no events arrive for >30 minutes (
staleEventThresholdMsdefaults to 1,800,000ms). During idle periods (e.g., nighttime), this causes ~38 unnecessary socket restarts per day.Root Cause
In
gateway-cli-*.js,resolveTimingPolicy()falls back to18e5(30min) whendeps.timing?.staleEventThresholdMsis undefined. The main health monitor call site (startChannelHealthMonitor()) only passeschannelManagerandcheckIntervalMs— notimingobject.Impact
Requested Change
Expose
staleEventThresholdMsas a configurable option, e.g.:{ "gateway": { "channelHealthCheckMinutes": 5, "channelHealthMonitor": { "staleEventThresholdMs": 7200000 } } }Suggested default: 2 hours (7,200,000ms) for long-socket channels like WhatsApp.
Environment