Repository navigation
fix(whatsapp): remove dead Math.max in watchdog app-silence formula - #93330
rushindrasinha wants to merge 4 commits into
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 22, 2026, 4:03 AM ET / 08:03 UTC. Summary PR surface: Source 0, Tests +514, Other +24. Total +538 across 33 files. Reproducibility: yes. Current main and Review metrics: 1 noteworthy metric.
Stored data model 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. Next step before merge
Security Review detailsBest possible solution: Land the narrow WhatsApp cleanup after maintainer review and exact-head checks, while keeping public watchdog tuning and active liveness policy in the separate open WhatsApp items. Do we have a high-confidence way to reproduce the issue? Yes. Current main and Is this the best way to solve the issue? Yes. Direct multiplication plus focused fake-timer coverage is the narrowest maintainable fix for this cleanup; operator-facing watchdog tuning belongs to the linked config issue and PR. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d3f7f7d1fc91. Label changesLabel justifications:
Evidence reviewedPR surface: Source 0, Tests +514, Other +24. Total +538 across 33 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
|
28616bf to
8b42ce8
Compare
appSilenceTimeoutMs was computed as Math.max(x, x*4) which always resolves to x*4 — the Math.max call was dead code. Simplify to messageTimeoutMs * 4 directly and add a regression test that pins the 4x multiplier as the silence window for fresh connections. Co-Authored-By: Dr Rushindra Sinha <[email protected]>
8b42ce8 to
f0c6cab
Compare
Dependency GuardThis PR changes dependency-related files. Maintainers should confirm these changes are intentional. Changed files:
Maintainer follow-up:
|
Dependency graph changes are blockedOpenClaw does not accept dependency graph changes through PRs unless a repository admin or security explicitly authorizes the current head SHA. Dependency updates are generated internally by maintainers so external PRs cannot change the resolved graph. Detected dependency graph changes:
To remove lockfile changes, restore them from the target branch: git fetch origin
git checkout 'origin/main' -- 'extensions/clickclack/npm-shrinkwrap.json' 'extensions/fireworks/npm-shrinkwrap.json' 'extensions/irc/npm-shrinkwrap.json' 'extensions/mattermost/npm-shrinkwrap.json' 'extensions/moonshot/npm-shrinkwrap.json' 'extensions/searxng/npm-shrinkwrap.json' 'extensions/signal/npm-shrinkwrap.json' 'extensions/sms/npm-shrinkwrap.json' 'extensions/tavily/npm-shrinkwrap.json' 'extensions/tencent/npm-shrinkwrap.json' 'extensions/venice/npm-shrinkwrap.json' 'extensions/vercel-ai-gateway/npm-shrinkwrap.json' 'extensions/zai/npm-shrinkwrap.json'
git commit -m 'chore: remove dependency lockfile change'
git pushIf this PR intentionally needs a dependency graph change, ask a repository admin or member of The action will approve the current head SHA ( |
|
Superseded by and landed as #95706 (merge commit 89eb493). The replacement preserved the original contributor credit, kept the two-file WhatsApp watchdog fix narrow, passed focused tests (18/18), autoreview, exact-head CI, and native merge verification. Closing this stale-base copy; #95706 is the canonical landed change. |
Problem
WhatsAppConnectionControllercomputes the app-silence timeout at construction:messageTimeoutMs * 4is always≥ messageTimeoutMs, soMath.maxunconditionally returnsmessageTimeoutMs * 4. The guard is dead code — a reader expectingMath.maxto do something meaningful will be confused, and a future refactor that replaces the second argument (intending to raise the floor) will silently break the intended behaviour.Default values:
messageTimeoutMs = 30 min→appSilenceTimeoutMs = 120 min. Runtime effect is unchanged; this is a correctness/clarity fix.Fix
Remove the dead
Math.maxwrapper:Test
Added a test in
connection-controller.test.ts:"uses messageTimeoutMs × 4 as the app-silence window for fresh connections with no inbound"
Advances fake-timer time to just before the 4× window → no timeout; then past it → timeout fires. This pins the multiplier as a regression guard against future edits that alter the constant.
All 14
connection-controllertests pass.Spotted while auditing the watchdog reconnect path on a production deployment.
Real behavior proof
appSilenceTimeoutMswas computed asMath.max(messageTimeoutMs, messageTimeoutMs * 4). SincemessageTimeoutMs * 4 >= messageTimeoutMsfor all positive timeouts, theMath.maxis dead code that always returnsmessageTimeoutMs * 4. This change removes it. The fix must be behavior-preserving — the watchdog's app-silence window must not change.WhatsAppConnectionControllerfrom this branch vianode --import tsxand read back the app-silence window it computes for representative timeout values.messageTimeoutMs∈ {5000, 30000, 120000} and compared the liveappSilenceTimeoutMsfield against both the oldMath.max(...)formula and the new* 4formula:node --import tsx proof-watchdog.mtsmessageTimeoutMs * 4for every case, identical to the pre-fixMath.maxoutput (20s, 120s, 480s respectively). Confirms the watchdog's behavior is unchanged and the removed branch was dead code.