#23685: fix(whatsapp): restore selfChatMode config usage in access control
channel: whatsapp-web
size: XS
Cluster:
WhatsApp and Google Chat Fixes
## 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
#22106: fix(whatsapp): honor selfChatMode override for group mentions
by sportclaw · 2026-02-20
72.5%
#21889: fix(whatsapp): include outbound DMs in agent context for allowed co...
by mactsk · 2026-02-20
71.2%
#14789: fix: per-account dmPolicy ignored in checkInboundAccessControl
by croll83 · 2026-02-12
70.5%
#20921: WhatsApp: enforce allowFrom for explicit outbound sends
by zahlmann · 2026-02-19
70.3%
#5665: fix: match group JIDs in groupAllowFrom allowlist
by koala73 · 2026-01-31
68.3%
#4402: fix: store group messages from non-allowlisted senders as pending c...
by adam91holt · 2026-01-30
68.1%
#11249: fix(whatsapp): prevent pairing-mode auto-replies to unknown DMs
by liuxiaopai-ai · 2026-02-07
67.8%
#23251: fix(whatsapp): include LID in implicit mention detection for group ...
by SidQin-cyber · 2026-02-22
67.6%
#17882: fix: drop WhatsApp pairing reply for unconfigured accounts
by adit-negi · 2026-02-16
67.4%
#16942: fix(whatsapp): add typingIndicator config to avoid rate limits
by MisterGuy420 · 2026-02-15
67.2%