fix(whatsapp): widen reconnect-window retries#43978
fix(whatsapp): widen reconnect-window retries#43978stim64045-spec wants to merge 1 commit intoopenclaw:mainfrom
Conversation
Greptile SummaryThis PR widens the WhatsApp reconnect retry window (3→5 attempts, 500ms→1000ms base backoff, max ~10 s of wait) and surfaces final delivery failures as structured system events so agents get a signal when a message is permanently undelivered. The changes are targeted and well-tested. Key observations:
Confidence Score: 3/5
|
Summary
Fixes #14827.
When WhatsApp Web is reconnecting after a transient 408/503-style disconnect, replies could exhaust their retry budget before the socket was usable again. The delivery failure was then only logged by the dispatcher, so the agent had no structured signal that the message never reached the user.
What changed
1) Widen the WhatsApp send retry window
In
src/web/auto-reply/deliver-reply.ts:That extends the retry window enough to cover the typical 3–5s reconnect gap without introducing a broader outbound queue.
2) Surface delivery failures to the agent
In
src/web/auto-reply/monitor/process-message.ts:That means the failure is no longer silent from the agent/session perspective.
Why this scope
This is the smallest safe fix I could make with high confidence:
Tradeoff: this does not add a durable outbound queue. If the reconnect gap exceeds the wider retry window, delivery can still fail — but now it is surfaced instead of disappearing silently.
Tests
pnpm exec vitest run src/web/auto-reply/deliver-reply.test.ts src/web/auto-reply/monitor/process-message.inbound-contract.test.tspnpm exec tsc --noEmit