openclaw - 💡(How to fix) Fix [Bug]: WhatsApp group @mentions not detected when LID mentions are present (wasMentioned=false even though normalizedMentionedJids matches selfE164) [2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#49317Fetched 2026-04-08 00:56:35
View on GitHub
Comments
2
Participants
3
Timeline
4
Reactions
0
Timeline (top)
commented ×2labeled ×2

Mention detection bug — a real bug in OpenClaw where wasMentioned always returns false because the bot's own number being in allowFrom triggers a isSelfChat code path that skips the E164 comparison. This should be reported to the OpenClaw team

ENVIRONMENT

OpenClaw version: 2026.3.2 Channel: WhatsApp (web provider) Context: WhatsApp group chat Self number example: +16462383987 Mention format observed: 216372600647751@lid (WhatsApp LID mention) Config: group set to not require mention (requireMention: false) didn’t fix mention detection (still logs wasMentioned=false) STEPS TO REPRODUCE

Install and run OpenClaw with WhatsApp connected/linked. Ensure the bot WhatsApp account (e.g. +16462383987) is added to a WhatsApp group. In ~/.openclaw/openclaw.json, allow the group to trigger (any of the following is fine): channels.whatsapp.groupPolicy is open, OR group is allowlisted appropriately, and senders are in groupAllowFrom. In the WhatsApp group, send a message that @mentions the bot using the WhatsApp UI mention feature (tap the bot participant and mention them). Example message body seen in logs: “@216372600647751 can you see this?” Observe OpenClaw logs for the “group mention debug” entry. EXPECTED

When the bot is @mentioned in the group, OpenClaw should detect it and set: wasMentioned: true Particularly when: normalizedMentionedJids contains the bot’s E.164 (e.g. ["+16462383987"]) and selfE164 is the same (e.g. "+16462383987") ACTUAL

OpenClaw logs show mention resolution succeeds, but mention detection still fails: mentionedJids: ["216372600647751@lid"] normalizedMentionedJids: ["+16462383987"] selfE164: "+16462383987" wasMentioned: false (incorrect) LOG EVIDENCE (example) From /tmp/openclaw/openclaw-2026-03-17.log:

“group mention debug” conversationId: [email protected] body: @216372600647751 can you see this? mentionedJids: [ "216372600647751@lid" ] normalizedMentionedJids: [ "+16462383987" ] selfE164: "+16462383987" wasMentioned: false ROOT CAUSE (code-level) In dist/channel-web-*.js, function isBotMentionedFromTargets(msg, mentionCfg, targets):

It computes: isSelfChat = isSelfChatMode(targets.selfE164, mentionCfg.allowFrom) If isSelfChat is true and there are mentions, it skips the direct match check and falls through to text-regex matching, which fails for LID-style mentions. There’s an empty branch: } else if (hasMentions && isSelfChat) {} So when the bot’s own number appears in mentionCfg.allowFrom (common/likely default), isSelfChat becomes true and normalizedMentions.includes(selfE164) is never checked, even though it should be.

WORKAROUND

If group activation is set to “always” / requireMention: false, the bot can still respond without mention detection. But mention detection itself remains incorrect (still logs wasMentioned=false). SUGGESTED FIX

In the hasMentions && isSelfChat path, also check: targets.normalizedMentions.includes(targets.selfE164) and/or targets.selfJid Or change the definition of “self chat” so it does not trigger for group messages based on allowFrom. Remove the empty else if (hasMentions && isSelfChat) {} fall-through.

Root Cause

Mention detection bug — a real bug in OpenClaw where wasMentioned always returns false because the bot's own number being in allowFrom triggers a isSelfChat code path that skips the E164 comparison. This should be reported to the OpenClaw team

Fix Action

Fix / Workaround

WORKAROUND

RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Summary

Mention detection bug — a real bug in OpenClaw where wasMentioned always returns false because the bot's own number being in allowFrom triggers a isSelfChat code path that skips the E164 comparison. This should be reported to the OpenClaw team

ENVIRONMENT

OpenClaw version: 2026.3.2 Channel: WhatsApp (web provider) Context: WhatsApp group chat Self number example: +16462383987 Mention format observed: 216372600647751@lid (WhatsApp LID mention) Config: group set to not require mention (requireMention: false) didn’t fix mention detection (still logs wasMentioned=false) STEPS TO REPRODUCE

Install and run OpenClaw with WhatsApp connected/linked. Ensure the bot WhatsApp account (e.g. +16462383987) is added to a WhatsApp group. In ~/.openclaw/openclaw.json, allow the group to trigger (any of the following is fine): channels.whatsapp.groupPolicy is open, OR group is allowlisted appropriately, and senders are in groupAllowFrom. In the WhatsApp group, send a message that @mentions the bot using the WhatsApp UI mention feature (tap the bot participant and mention them). Example message body seen in logs: “@216372600647751 can you see this?” Observe OpenClaw logs for the “group mention debug” entry. EXPECTED

When the bot is @mentioned in the group, OpenClaw should detect it and set: wasMentioned: true Particularly when: normalizedMentionedJids contains the bot’s E.164 (e.g. ["+16462383987"]) and selfE164 is the same (e.g. "+16462383987") ACTUAL

OpenClaw logs show mention resolution succeeds, but mention detection still fails: mentionedJids: ["216372600647751@lid"] normalizedMentionedJids: ["+16462383987"] selfE164: "+16462383987" wasMentioned: false (incorrect) LOG EVIDENCE (example) From /tmp/openclaw/openclaw-2026-03-17.log:

“group mention debug” conversationId: [email protected] body: @216372600647751 can you see this? mentionedJids: [ "216372600647751@lid" ] normalizedMentionedJids: [ "+16462383987" ] selfE164: "+16462383987" wasMentioned: false ROOT CAUSE (code-level) In dist/channel-web-*.js, function isBotMentionedFromTargets(msg, mentionCfg, targets):

It computes: isSelfChat = isSelfChatMode(targets.selfE164, mentionCfg.allowFrom) If isSelfChat is true and there are mentions, it skips the direct match check and falls through to text-regex matching, which fails for LID-style mentions. There’s an empty branch: } else if (hasMentions && isSelfChat) {} So when the bot’s own number appears in mentionCfg.allowFrom (common/likely default), isSelfChat becomes true and normalizedMentions.includes(selfE164) is never checked, even though it should be.

WORKAROUND

If group activation is set to “always” / requireMention: false, the bot can still respond without mention detection. But mention detection itself remains incorrect (still logs wasMentioned=false). SUGGESTED FIX

In the hasMentions && isSelfChat path, also check: targets.normalizedMentions.includes(targets.selfE164) and/or targets.selfJid Or change the definition of “self chat” so it does not trigger for group messages based on allowFrom. Remove the empty else if (hasMentions && isSelfChat) {} fall-through.

Steps to reproduce

Install and run OpenClaw with WhatsApp connected/linked. Ensure the bot WhatsApp account (e.g. +16462383987) is added to a WhatsApp group. In ~/.openclaw/openclaw.json, allow the group to trigger (any of the following is fine): channels.whatsapp.groupPolicy is open, OR group is allowlisted appropriately, and senders are in groupAllowFrom. In the WhatsApp group, send a message that @mentions the bot using the WhatsApp UI mention feature (tap the bot participant and mention them). Example message body seen in logs: “@216372600647751 can you see this?” Observe OpenClaw logs for the “group mention debug” entry.

Expected behavior

EXPECTED

When the bot is @mentioned in the group, OpenClaw should detect it and set: wasMentioned: true Particularly when: normalizedMentionedJids contains the bot’s E.164 (e.g. ["+16462383987"]) and selfE164 is the same (e.g. "+16462383987")

Actual behavior

ACTUAL

OpenClaw logs show mention resolution succeeds, but mention detection still fails: mentionedJids: ["216372600647751@lid"] normalizedMentionedJids: ["+16462383987"] selfE164: "+16462383987" wasMentioned: false (incorrect)

OpenClaw version

2026.3.2

Operating system

Linux (kernel 6.6.113+, x64)

Install method

npm global install (

Model

emergent-claude/claude-opus-4-6

Provider / routing chain

OpenClaw → Emergent Agent LLM proxy (https://integrations.emergentagent.com/llm) → Anthropic Messages API → claude-opus-4-6

Config file / key location

No response

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

extent analysis

Fix Plan

To fix the mention detection bug, we need to modify the isBotMentionedFromTargets function in dist/channel-web-*.js.

  • Update the hasMentions && isSelfChat path to check if the bot's own number is in the normalizedMentions list:
if (hasMentions && isSelfChat) {
  if (targets.normalizedMentions.includes(targets.selfE164)) {
    wasMentioned = true;
  }
}
  • Remove the empty else if (hasMentions && isSelfChat) {} block to prevent the fall-through to text-regex matching.

Code Changes

The updated isBotMentionedFromTargets function should look like this:

function isBotMentionedFromTargets(msg, mentionCfg, targets) {
  // ...
  const isSelfChat = isSelfChatMode(targets.selfE164, mentionCfg.allowFrom);
  if (hasMentions) {
    if (isSelfChat) {
      if (targets.normalizedMentions.includes(targets.selfE164)) {
        wasMentioned = true;
      }
    } else {
      // existing code for non-self chat
    }
  }
  // ...
}

Verification

To verify the fix, follow the steps to reproduce the issue and check the OpenClaw logs for the "group mention debug" entry. The wasMentioned field should now be set to true when the bot is @mentioned in the group.

Extra Tips

  • Make sure to update the dist/channel-web-*.js file correctly, as it may be generated by a build process.
  • If you're using a version control system, create a new branch for the fix and test it thoroughly before merging it into the main branch.
  • Consider reporting the fix to the OpenClaw team to ensure it gets incorporated into future releases.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

EXPECTED

When the bot is @mentioned in the group, OpenClaw should detect it and set: wasMentioned: true Particularly when: normalizedMentionedJids contains the bot’s E.164 (e.g. ["+16462383987"]) and selfE164 is the same (e.g. "+16462383987")

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING