Skip to content

fix(whatsapp): restart listener on selfChatMode config change#93873

Merged
steipete merged 3 commits into
openclaw:mainfrom
xialonglee:fix/issue-86888-whatsapp-selfchatmode-reload
Jun 19, 2026
Merged

fix(whatsapp): restart listener on selfChatMode config change#93873
steipete merged 3 commits into
openclaw:mainfrom
xialonglee:fix/issue-86888-whatsapp-selfchatmode-reload

Conversation

@xialonglee

@xialonglee xialonglee commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Root Cause

extensions/whatsapp/src/shared.ts:185 lists channels.whatsapp as a noopPrefix, so changing channels.whatsapp.selfChatMode does not trigger a WhatsApp listener restart; the connect-time presence value stays stale until a full restart. The noopPrefixes rules are checked after configPrefixes rules in the reload planner, but the specific selfChatMode key was never listed in configPrefixes, so it fell through to the broad channels.whatsapp noop match.

Summary

Verification

  • pnpm test extensions/whatsapp/index.test.ts — 3/3 passed
  • pnpm test src/gateway/config-reload.test.ts — 352/352 passed (total 355/355)
  • Autoreview: clean — no accepted/actionable findings

Real behavior proof

Behavior addressed: WhatsApp selfChatMode config change did not trigger a WhatsApp channel restart, leaving stale presence behavior until a full gateway restart.

Real environment tested: Linux (4.19.112-2.el8.x86_64), Node v24.15.0, branch fix/issue-86888-whatsapp-selfchatmode-reload at commit 83b809b3a2.

Exact steps or command run after this patch:

pnpm test extensions/whatsapp/index.test.ts
pnpm test src/gateway/config-reload.test.ts

Evidence after fix:

$ pnpm test extensions/whatsapp/index.test.ts
 Test Files  1 passed (1)
      Tests  3 passed (3)

$ pnpm test src/gateway/config-reload.test.ts
 Test Files  4 passed (4)
      Tests  352 passed (352)

Observed result after fix: All 355 tests pass. The new test "restarts the WhatsApp channel when selfChatMode changes (configPrefix wins over broad noop prefix)" confirms that changing channels.whatsapp.selfChatMode triggers a channel restart (not a restartGateway or noop), validating the specific prefix match ordering in buildGatewayReloadPlan. The existing test "keeps other channels.whatsapp.* changes as hot no-ops" still passes, confirming that other channels.whatsapp.* paths remain unaffected.

What was not tested: Full E2E WhatsApp connection test (requires real WhatsApp credentials). The fix relies on the same reload.configPrefixes pattern already proven by channels.whatsapp.accounts in production.

@openclaw-barnacle openclaw-barnacle Bot added channel: whatsapp-web Channel integration: whatsapp-web gateway Gateway runtime size: XS triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels Jun 17, 2026
@clawsweeper

clawsweeper Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed June 19, 2026, 8:37 AM ET / 12:37 UTC.

Summary
The PR adds channels.whatsapp.selfChatMode to WhatsApp channel-restart reload metadata and adds planner plus hot-reload handler tests for that path.

PR surface: Source 0, Tests +55. Total +55 across 4 files.

Reproducibility: yes. at source level: current main classifies channels.whatsapp.selfChatMode under the broad WhatsApp no-op rule, while the listener sends presence from selfChatMode when it attaches. I did not run a credentialed live WhatsApp reproduction.

Review metrics: 1 noteworthy metric.

  • Reload Metadata Behavior: 1 existing config path changed from no-op to channel restart. This affects runtime restart behavior for a live WhatsApp listener, so maintainers should notice the availability proof gap before merge.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #86888
Summary: This PR is the direct candidate fix for the canonical WhatsApp presence reload issue; the merged account-prefix PR shares the broad no-op-prefix root cause for a different subtree.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🦞 diamond lobster
Result: blocked until real behavior proof from a real setup is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Add redacted live WhatsApp proof showing the selfChatMode config change restarts the listener or updates presence without a full gateway restart.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The supplied proof is focused tests, CI, and Crabbox test execution only; no redacted live WhatsApp listener or presence proof is shown. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Mantis proof suggestion
A redacted real WhatsApp run or visible terminal/desktop proof would materially reduce the remaining availability uncertainty. A maintainer can ask Mantis to capture proof by posting this exact PR comment:

@openclaw-mantis visual task: verify changing channels.whatsapp.selfChatMode restarts the WhatsApp listener and refreshes presence without a full gateway restart.

Risk before merge

  • [P1] Merging intentionally changes channels.whatsapp.selfChatMode hot reload from no-op to live WhatsApp channel restart; source tests prove planner-to-handler behavior, but no redacted live listener or presence refresh proof is available.

Maintainer options:

  1. Require Live WhatsApp Restart Proof (recommended)
    Ask for redacted logs, terminal output, or a recording showing a selfChatMode config change restarts the WhatsApp listener and refreshes presence without a full gateway restart.
  2. Accept Source-Level Proof
    Maintainers can intentionally merge with planner-to-handler proof only, accepting that the live WhatsApp listener and Baileys presence path was not observed.
  3. Pause For Safe Credentials
    Keep the PR open until someone with a safe WhatsApp test account can produce the missing runtime evidence.

Next step before merge

  • [P1] Needs human-supplied live WhatsApp proof or explicit maintainer acceptance of source-level proof; no automated code repair is indicated.

Security
Cleared: The diff changes TypeScript reload metadata and tests only; it does not add dependencies, workflows, scripts, permissions, secret handling, or downloaded code.

Review details

Best possible solution:

Land the narrow plugin-owned reload prefix after redacted live WhatsApp restart/presence proof or explicit maintainer acceptance of deterministic source-level proof.

Do we have a high-confidence way to reproduce the issue?

Yes at source level: current main classifies channels.whatsapp.selfChatMode under the broad WhatsApp no-op rule, while the listener sends presence from selfChatMode when it attaches. I did not run a credentialed live WhatsApp reproduction.

Is this the best way to solve the issue?

Yes: plugin-owned reload metadata is the narrowest maintainable fix, and the PR adds focused planner/handler coverage. The remaining blocker is runtime proof or maintainer risk acceptance, not a better code location.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against aea208f0ac51.

Label changes

Label justifications:

  • P2: This is a bounded WhatsApp channel behavior bug with source-level reproduction and limited blast radius.
  • merge-risk: 🚨 availability: The diff makes a hot config update stop and start the WhatsApp channel, and the live listener recovery path has not been proven.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦞 diamond lobster.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The supplied proof is focused tests, CI, and Crabbox test execution only; no redacted live WhatsApp listener or presence proof is shown. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source 0, Tests +55. Total +55 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 1 1 1 0
Tests 3 60 5 +55
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 61 6 +55

What I checked:

Likely related people:

  • MukundaKatta: Authored the merged WhatsApp account-prefix reload fix whose configPrefixes pattern this PR extends to selfChatMode. (role: introduced adjacent behavior; confidence: high; commits: d96648624234, f8e4f82eca9e; files: extensions/whatsapp/src/shared.ts, src/gateway/config-reload.test.ts, extensions/whatsapp/index.test.ts)
  • mcaxtr: Authored the connect-time selfChatMode presence behavior and co-authored/reviewed adjacent WhatsApp reload metadata work. (role: feature-history owner; confidence: high; commits: e1c96785ac75, 458a52610a4d, 4142d5562eef; files: extensions/whatsapp/src/inbound/monitor.ts, extensions/whatsapp/src/accounts.ts, extensions/whatsapp/src/shared.ts)
  • steipete: Has reload-pipeline history, authored the branch's handler-level test commit, and posted exact-head verification for this PR. (role: adjacent owner and likely follow-up owner; confidence: medium; commits: 55a2d12f4033, ba79d903137e, d85f604f0111; files: src/gateway/server-reload-handlers.ts, src/gateway/server-reload-handlers.test.ts, extensions/whatsapp/src/shared.ts)
  • vincentkoc: Owns the broader open channel/config repair PR that overlaps config reload and channel ownership surfaces, though it is not canonical for this exact selfChatMode fix. (role: adjacent channel/config repair owner; confidence: medium; commits: 7551d79de50a; files: src/gateway/config-reload-plan.ts, src/gateway/config-reload.test.ts, src/config/mutate.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@openclaw-barnacle openclaw-barnacle Bot added proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels Jun 17, 2026
@xialonglee

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@xialonglee xialonglee force-pushed the fix/issue-86888-whatsapp-selfchatmode-reload branch from 83b809b to dfa8767 Compare June 19, 2026 02:06
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Jun 19, 2026
@steipete steipete self-assigned this Jun 19, 2026
@steipete steipete force-pushed the fix/issue-86888-whatsapp-selfchatmode-reload branch from dfa8767 to 0ad36af Compare June 19, 2026 09:12
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. label Jun 19, 2026

Copy link
Copy Markdown
Contributor

Land-ready verification for exact head 0ad36af61c876496dd995ae9b05e87b4d96308d0:

  • node scripts/run-vitest.mjs extensions/whatsapp/index.test.ts src/gateway/config-reload.test.ts src/gateway/server-reload-handlers.test.ts — 397 tests passed.
  • Fresh autoreview — clean, no accepted/actionable findings.
  • AWS Crabbox cbx_72c1f9939620, run run_a06ab71a7384 — same 397 tests passed.
  • Capacity-stall fallback CI run 27818952457 — full exact-head matrix passed.
  • Scheduled CodeQL, CodeQL Critical Quality, OpenGrep, Workflow Sanity, and iOS Periphery — passed; scheduled CI remains queued behind repository capacity.

Known proof gap: no live WhatsApp session is configured; deterministic planner-to-handler integration proves the listener stop/start contract.

@steipete steipete force-pushed the fix/issue-86888-whatsapp-selfchatmode-reload branch 4 times, most recently from 7b06a7f to 6fe096f Compare June 19, 2026 11:43
xialonglee and others added 3 commits June 19, 2026 08:32
Switching WhatsApp from personal phone (selfChatMode: true) to separate
phone (selfChatMode: false) now triggers a channel restart, so the
connect-time presence value is recalculated.

The selfChatMode path was previously swallowed by the broad
channels.whatsapp noop prefix.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Matches the production reload metadata after adding
channels.whatsapp.selfChatMode to the configPrefixes array.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@steipete steipete force-pushed the fix/issue-86888-whatsapp-selfchatmode-reload branch from 6fe096f to d85f604 Compare June 19, 2026 12:32
@steipete steipete merged commit 5c87619 into openclaw:main Jun 19, 2026
293 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

Thanks @xialonglee!

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jun 20, 2026
…aw#93873)

Merged via squash.

Prepared head SHA: d85f604
Co-authored-by: xialonglee <22994703+xialonglee@users.noreply.github.com>
Co-authored-by: steipete <58493+steipete@users.noreply.github.com>
Reviewed-by: @steipete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: whatsapp-web Channel integration: whatsapp-web gateway Gateway runtime merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P2 Normal backlog priority with limited blast radius. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: WhatsApp presence does not update after switching from personal phone to separate phone

2 participants