← Back to PRs

#23685: fix(whatsapp): restore selfChatMode config usage in access control

by ekson73 open 2026-02-22 15:55 View on GitHub →
channel: whatsapp-web size: XS
## Summary The `selfChatMode` config field was introduced in ef644b836 to combine with the `allowFrom`-based heuristic (`isSelfChatMode`) into a `selfPhoneMode` flag. This flag gated outbound DM suppression to self-phone setups only. During the refactor that split `inbound.ts` into `access-control.ts` + `monitor.ts`, the `selfPhoneMode` variable was lost. The outbound DM skip became unconditional (`isFromMe && !isSamePhone`), ignoring the config field entirely. ## The Problem - The onboarding wizard still sets `selfChatMode` - The docs still tell users to enable it - `accounts.ts` still resolves it (`accountCfg?.selfChatMode ?? rootCfg?.selfChatMode`) - **But no runtime code consumes the resolved value** This means the config field is effectively dead code since the refactor. ## The Fix Restore the original `selfPhoneMode` behavior in `access-control.ts`: ```ts // Before (broken — ignores config): const isSelfChat = isSelfChatMode(params.selfE164, configuredAllowFrom); // After (restored — respects config): const isSelfChat = isSelfChatMode(params.selfE164, configuredAllowFrom); const selfPhoneMode = params.selfChatMode || isSelfChat; ``` The `selfPhoneMode` flag is then used where `isSelfChat` was previously used alone, so the config field gates the behavior as originally intended. ## Why This Matters Users running dual-account WhatsApp setups (e.g. personal + business number) set `selfChatMode: false` to tell OpenClaw "this is NOT a self-phone setup — don't suppress outbound DMs." Without this fix, that setting has zero effect. ## How to Verify 1. Set `selfChatMode: false` on a WhatsApp account with `allowFrom` containing only the owner's numbers 2. Before fix: outbound DM suppression still applies (heuristic overrides config) 3. After fix: outbound DMs are NOT suppressed (config is respected) ## Files Changed - `src/web/inbound/access-control.ts` — 4 insertions, 2 deletions ## Related - Issue #23788 — bug report for this regression - PR #23721 — expose `account_id` in inbound_meta (related multi-account work) - Commit `ef644b836` — original implementation (2026-01-07) - Refactor (Jan 13-15) — when `selfPhoneMode` was lost

Most Similar PRs