Bug
The WhatsApp watchdog timer causes an infinite reconnect loop during quiet hours (night, weekends, etc.) when no messages are received for 30+ minutes.
Root Cause
In channel.runtime-Dto237Iv.js (the WhatsApp web channel runtime):
MESSAGE_TIMEOUT_MS defaults to 30 minutes (1800s)
- When a connection starts,
lastInboundAt is initialized from the previous connection's value (line ~2630: createActiveConnectionRun(status.lastInboundAt ?? status.lastMessageAt ?? null))
- After 30 min of silence, the watchdog kills the connection and forces a reconnect
- The new connection inherits the old
lastInboundAt timestamp
- The watchdog immediately sees "30+ min since last message" and kills the connection again
- This creates an infinite reconnect loop
Expected Behavior
After a reconnect, the watchdog should give the new connection fresh time before considering it stale. The lastInboundAt should be reset (or the watchdog should use connection start time as baseline).
Proposed Fix
In createActiveConnectionRun(), reset lastInboundAt to null (or Date.now()) instead of inheriting the old value. This way the watchdog only triggers after 30 real minutes of silence on the new connection, not based on stale timestamps from the old one.
Workaround
Increase MESSAGE_TIMEOUT_MS to 4 hours (hotpatch the default from 1800 * 1e3 to 14400 * 1e3).
Affected File
dist/channel.runtime-Dto237Iv.js (built from the WhatsApp web channel monitor source)
Bug
The WhatsApp watchdog timer causes an infinite reconnect loop during quiet hours (night, weekends, etc.) when no messages are received for 30+ minutes.
Root Cause
In
channel.runtime-Dto237Iv.js(the WhatsApp web channel runtime):MESSAGE_TIMEOUT_MSdefaults to 30 minutes (1800s)lastInboundAtis initialized from the previous connection's value (line ~2630:createActiveConnectionRun(status.lastInboundAt ?? status.lastMessageAt ?? null))lastInboundAttimestampExpected Behavior
After a reconnect, the watchdog should give the new connection fresh time before considering it stale. The
lastInboundAtshould be reset (or the watchdog should use connection start time as baseline).Proposed Fix
In
createActiveConnectionRun(), resetlastInboundAttonull(orDate.now()) instead of inheriting the old value. This way the watchdog only triggers after 30 real minutes of silence on the new connection, not based on stale timestamps from the old one.Workaround
Increase
MESSAGE_TIMEOUT_MSto 4 hours (hotpatch the default from1800 * 1e3to14400 * 1e3).Affected File
dist/channel.runtime-Dto237Iv.js(built from the WhatsApp web channel monitor source)