fix(whatsapp): report transport activity so stale-socket health detection works#72656
Conversation
Greptile SummaryThis PR fixes a gap where WhatsApp's Confidence Score: 5/5Safe to merge — minimal, targeted fix with full test coverage for the affected paths. The change is small (3 files, ~10 lines of logic), follows an established pattern already proven by other extensions, the new unit tests directly verify all critical behaviors (connected sets activity, inbound updates it, watchdog-stale preserves it), and no existing tests are affected. No files require special attention. Reviews (1): Last reviewed commit: "fix(whatsapp): report transport activity..." | Re-trigger Greptile |
|
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Keep open. Current main still does not publish WhatsApp Best possible solution: Keep this PR open for maintainer review. The best path is to review and land or revise the narrow WhatsApp-owned status propagation: publish real transport activity through What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 64533ed7b1e7. |
a389d5c to
abc3c18
Compare
abc3c18 to
1b19207
Compare
|
Merged via squash.
Thanks @Sathvik-1007! |
…tion works (openclaw#72656) Merged via squash. Prepared head SHA: 1b19207 Co-authored-by: Sathvik-1007 <195685832+Sathvik-1007@users.noreply.github.com> Co-authored-by: mcaxtr <7562095+mcaxtr@users.noreply.github.com> Reviewed-by: @mcaxtr
Summary
lastTransportActivityAtin its status snapshot. The gateway health policy skips stale-socket detection when this field is null (channel-health-policy.ts:117), so a wedged WhatsApp socket is invisible to the health monitor indefinitely.monitor-state.tsnow callscreateTransportActivityStatusPatch(at)onnoteConnectedandnoteInbound, matching the pattern already used by Discord, Matrix, Slack, and Telegram. AddedlastTransportActivityAtto theWebChannelStatustype.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Root Cause (if applicable)
d8d0380297("fix: use transport activity for stale health", Apr 22) addedcreateTransportActivityStatusPatchcalls to Discord, Matrix, Slack, and Telegram — but WhatsApp was not updated. WhatsApp'smonitor-state.tsonly calledcreateConnectedChannelStatusPatch, which setsconnected/lastConnectedAt/lastEventAtbut notlastTransportActivityAt.lastTransportActivityAtis null (to avoid false positives on channels without transport tracking). This is correct behavior — the gap was WhatsApp not opting in.monitor-state.tswas created in a separate refactor (66743b84fa, Mar 22) before transport activity was introduced, so it was easy to miss during the Apr 22 rollout.Regression Test Plan (if applicable)
extensions/whatsapp/src/auto-reply/monitor-state.test.tsnoteConnectedandnoteInboundboth setlastTransportActivityAtto a non-null timestamp, enablingevaluateChannelHealthto run the stale-socket check path.channel-health-policy.test.ts).User-visible / Behavior Changes
WhatsApp channels now participate in the gateway's stale-socket health detection. If the WhatsApp WebSocket goes silent, the health monitor will detect it and restart the channel instead of waiting for WhatsApp's own 408 timeout (which can take up to 30 minutes).
Diagram (if applicable)
Security Impact (required)
Repro + Verification
Environment
Steps
pnpm test extensions/whatsapp/src/auto-reply/monitor-state.test.ts— 4/4 passpnpm test src/gateway/channel-health-policy.test.ts— 16/16 passpnpm test:extension whatsapp— 537/537 passpnpm build— cleanpnpm tsgo:prod— cleanpnpm check:changed— 113/113 passExpected
noteConnectedandnoteInboundsetlastTransportActivityAtso the health monitor can detect stale WhatsApp sockets.Actual
Confirmed via unit tests.
Evidence
New test file
monitor-state.test.tsverifieslastTransportActivityAtis set. Before this change, the field was never present in the status snapshot.Human Verification (required)
noteConnectedsets transport activity,noteInboundupdates it,noteWatchdogStaledoes NOT update it (correct — watchdog means the socket is idle)noteWatchdogStalepreserves oldlastTransportActivityAtinstead of refreshing it. Verified initial status has nolastTransportActivityAtkey (null-ish, won't trigger stale check before first connection).server-close.ts:108) unrelated to transport activity.Review Conversations
Compatibility / Migration
Risks and Mitigations