fix(whatsapp): preserve auth on terminal disconnects#93076
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 15, 2026, 12:47 AM ET / 04:47 UTC. Summary PR surface: Source +7, Tests +298. Total +305 across 9 files. Reproducibility: yes. by source inspection: current main calls logoutWeb from terminal logged-out/conflict monitor stop paths, and the PR removes that passive cleanup while adding targeted harness coverage. I did not run a live WhatsApp logout/conflict reproduction in this read-only review. Review metrics: 1 noteworthy metric.
Stored data model 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 this credential-preservation slice only after maintainers accept the session-state lifecycle shift, refresh it against current main, and keep the restart-loop guard tracked separately. Do we have a high-confidence way to reproduce the issue? Yes, by source inspection: current main calls logoutWeb from terminal logged-out/conflict monitor stop paths, and the PR removes that passive cleanup while adding targeted harness coverage. I did not run a live WhatsApp logout/conflict reproduction in this read-only review. Is this the best way to solve the issue? Yes for the credential-preservation slice. The patch stays in the WhatsApp plugin and gateway web-login boundary, uses existing saved-auth/listener outcomes instead of new state, and leaves the broader restart-loop fix to the linked gateway PR. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7e0128ae659d. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +7, Tests +298. Total +305 across 9 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
|
1dcb9be to
86cdb86
Compare
86cdb86 to
35928fb
Compare
* fix(whatsapp): preserve auth on passive terminal stops * fix(whatsapp): recover stale web auth during relink * fix(gateway): defer channel stop until qr takeover
* fix(whatsapp): preserve auth on passive terminal stops * fix(whatsapp): recover stale web auth during relink * fix(gateway): defer channel stop until qr takeover
* fix(whatsapp): preserve auth on passive terminal stops * fix(whatsapp): recover stale web auth during relink * fix(gateway): defer channel stop until qr takeover
Summary
logoutWeb.logoutWeband then surfaces one replacement QR.web.login.startfrom stopping a running channel until a non-forced QR flow actually takes over.Verification
node scripts/run-vitest.mjs extensions/whatsapp/src/auto-reply.web-auto-reply.connection-and-logging.e2e.test.ts extensions/whatsapp/src/connection-controller.test.ts extensions/whatsapp/src/auth-store.test.ts extensions/whatsapp/src/logout.test.ts extensions/whatsapp/src/login.coverage.test.ts extensions/whatsapp/src/login-qr.test.ts src/gateway/server-methods/web.start.test.tspnpm check:test-typesgit diff --check.agents/skills/autoreview/scripts/autoreview --mode localrun-whatsapp-qa-branch.sh --pr 93076Real behavior proof
Behavior addressed: WhatsApp passive monitor terminal disconnects no longer remove saved credentials, while explicit login/relink/logout flows still own stale-auth cleanup.
Real environment tested: Local OpenClaw WhatsApp unit/e2e harness and gateway server-method harness in the branch worktree. Live WhatsApp QA also ran on the local maintainer host against PR 93076 using the
defaultdriver account,workSUT account, configured/redacted QA group, andmock-openai.Exact steps or command run after this patch:
node scripts/run-vitest.mjs extensions/whatsapp/src/auto-reply.web-auto-reply.connection-and-logging.e2e.test.ts extensions/whatsapp/src/connection-controller.test.ts extensions/whatsapp/src/auth-store.test.ts extensions/whatsapp/src/logout.test.ts extensions/whatsapp/src/login.coverage.test.ts extensions/whatsapp/src/login-qr.test.ts src/gateway/server-methods/web.start.test.ts;pnpm check:test-types;git diff --check;.agents/skills/autoreview/scripts/autoreview --mode local;run-whatsapp-qa-branch.sh --pr 93076Evidence after fix: Focused Vitest passed 3 shards: 2 gateway test files with 10 tests, 1 e2e file with 26 tests, and 5 WhatsApp extension files with 66 tests. Test typecheck and diff whitespace checks passed. Autoreview reported no accepted/actionable findings. Live WhatsApp QA ran 35 discovered scenarios and passed 35/35 with 0 failures and 0 skipped.
Observed result after fix: Passive logged-out/conflict monitor paths preserve auth files. QR login returns already-linked only with an active listener, recovers valid saved auth without QR when no listener exists, clears 401 stale auth once before a replacement QR, and fails clearly when cleanup reports auth still present. Forced relink still clears auth before QR generation, and non-forced gateway login failures do not stop a running channel before QR takeover. Live WhatsApp proof covered DM canary, pairing gate, group mention/audio gating, command replies, reply context, inbound image/audio/structured messages, outbound media/document/poll, message actions, access control, reply chunking, stream final accounting, native
/new, status reactions, allowlist quiet behavior, and native approval flows.Live WhatsApp QA artifacts:
fix/whatsapp-preserve-terminal-auth@86cdb86014156c6877d4e3223680ac59f9e6ec4dorigin/main@ac1042b09b5cfa4dcee7bfe1f8e5ae7771d4a35a.artifacts/qa-e2e/whatsapp-full-pr-93076-20260615-040153/whatsapp-qa-report.md.artifacts/qa-e2e/whatsapp-full-pr-93076-20260615-040153/qa-evidence.json.artifacts/qa-e2e/whatsapp-full-pr-93076-20260615-040153/whatsapp-qa-observed-messages.jsonWhat was not tested: No live-provider model call was run; the live WhatsApp lane used
mock-openai. No manual real-device QR scan or real conflict-session reproduction was run outside the automated QA lane.