fix(gateway): stop terminal WhatsApp restart loops#78511
Conversation
302204d to
ecfa1cd
Compare
|
Codex review: needs maintainer review before merge. Reviewed July 5, 2026, 8:45 AM ET / 12:45 UTC. Summary PR surface: Source +41, Tests +209, Docs +1. Total +251 across 17 files. Reproducibility: yes. from source inspection rather than a live run: current main treats any managed stopped channel as Review metrics: 1 noteworthy metric.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the focused restart-loop fix if exact-head CI remains green, then preserve any desired reauth-event or restart-budget work as a narrower follow-up to the canonical bug. Do we have a high-confidence way to reproduce the issue? Yes, from source inspection rather than a live run: current main treats any managed stopped channel as Is this the best way to solve the issue? Yes for the central restart-loop bug: the PR carries the WhatsApp-owned terminal-disconnect state through existing snapshot seams and checks it at both restart surfaces. Broader operator reauth events or retry-budget policy should remain separate follow-up work if maintainers want them. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 601b80c5f4c1. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +41, Tests +209, Docs +1. Total +251 across 17 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (1 earlier review cycle)
|
4508ca3 to
e0bb6da
Compare
e0bb6da to
a322132
Compare
fcd72af to
cdf751e
Compare
67f8fe1 to
e9f754f
Compare
Track `terminalDisconnect` through the WhatsApp status controller, channel runtime snapshot, and `ChannelAccountSnapshot` so the health-monitor and the `ChannelManager` task-exit handler both skip auto-restart when Baileys signals a terminal session end (loggedOut / connectionReplaced). Adds a `terminal-disconnect` `ChannelHealthEvaluationReason` so the policy layer returns a stable, named reason rather than falling through to `not-running`, preventing unbounded WebSocket/heap growth on multi-tenant gateways. Fixes openclaw#78419.
Co-authored-by: openperf <[email protected]>
e9f754f to
7c741fc
Compare
|
Land-ready proof for exact head
The terminal-disconnect fact remains WhatsApp-owned; core restart policy consumes only the generic channel snapshot and clears pending restart state before recovery timeout handling. |
|
Merged via squash.
|
* fix(gateway): prevent restart loops after terminal WhatsApp disconnects Track `terminalDisconnect` through the WhatsApp status controller, channel runtime snapshot, and `ChannelAccountSnapshot` so the health-monitor and the `ChannelManager` task-exit handler both skip auto-restart when Baileys signals a terminal session end (loggedOut / connectionReplaced). Adds a `terminal-disconnect` `ChannelHealthEvaluationReason` so the policy layer returns a stable, named reason rather than falling through to `not-running`, preventing unbounded WebSocket/heap growth on multi-tenant gateways. Fixes openclaw#78419. * fix(gateway): prioritize terminal disconnect recovery Co-authored-by: openperf <[email protected]> * docs(changelog): move WhatsApp restart fix to unreleased --------- Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Terminal WhatsApp disconnects such as logged-out and connection-replaced sessions could continue through recovery-stop timeout handling and schedule another automatic restart, creating a restart loop instead of waiting for operator reconnection.
Refs #78419.
Why This Change Was Made
The repaired branch carries the WhatsApp-owned terminal-disconnect fact through the generic channel snapshot and makes gateway restart policy check it before recovery timeout handling. Terminal state clears pending restart bookkeeping and resets attempts; ordinary transient disconnect recovery is unchanged.
User Impact
Logged-out or replaced WhatsApp sessions stop restarting automatically and remain stopped until the account is reconnected, avoiding noisy restart loops and repeated failed work.
Evidence
tbx_01kws0677akakqfpk9p8s1a0f9, Actions run28739070734.7c741fc2bbbc848ccf25374f34268ec002d36496.