-
-
Notifications
You must be signed in to change notification settings - Fork 52.5k
Description
Problem
Cron job announce delivery fails immediately when the WhatsApp Web listener is momentarily disconnected (status 428 reconnect cycle). The WhatsApp connection drops periodically and reconnects within ~7 seconds, but if a cron job completes during that brief window, announce delivery fails with:
Error: No active WhatsApp Web listener (account: default)
The existing retry mechanism (up to 3 retries via announceRetryCount) only handles "requester session is busy" — not channel unavailability.
Expected Behavior
Announce delivery should retry with a short backoff (e.g. 5s, 10s, 20s) when the channel returns a transient error like UNAVAILABLE / no active listener. The WhatsApp reconnect typically completes in <10 seconds, so a single retry after 10s would catch most cases.
Current Workarounds
delivery.bestEffort: true— prevents the job from being marked as failed, but the message is still lost- Staggering cron schedules off the top of the hour — reduces collision probability but doesn't eliminate it
Logs
[whatsapp] Web connection closed (status 428). Retry 1/12 in 2.37s…
[whatsapp] Listening for personal WhatsApp inbound messages. (reconnected ~7s later)
...
⇄ res ✗ agent errorCode=UNAVAILABLE errorMessage=Error: No active WhatsApp Web listener
Subagent completion direct announce failed
Proposal
Add a retry loop (3 attempts, 10s apart) to the announce delivery path in src/agents/subagent-announce.ts when the error is a transient channel unavailability (not a permanent config error like invalid target).