hermes - ✅(Solved) Fix [Bug]: WhatsApp self-chat mode silently drops user's own group messages [1 pull requests, 3 comments, 2 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
NousResearch/hermes-agent#20143Fetched 2026-05-06 06:38:25
View on GitHub
Comments
3
Participants
2
Timeline
11
Reactions
0
Timeline (top)
labeled ×4commented ×3cross-referenced ×2closed ×1

Root Cause

The bug is in scripts/whatsapp-bridge/bridge.js, in the fromMe message handling block:

Line ~212:

if (msg.key.fromMe) {
    if (isGroup || chatId.includes('status')) continue;  // ← drops ALL group fromMe messages

The isGroup || condition unconditionally skips group messages from the user. The intent was to prevent echo loops, but this is overly broad — it prevents ALL user group messages from reaching the gateway.

Line ~227:

if (!isSelfChat) continue;

Even if the first check is fixed, this line would block group messages in self-chat mode because groups can never match the selfChat JID comparison.

Fix Action

Fixed

PR fix notes

PR #20429: fix(whatsapp): pass fromMe group messages through bridge in self-chat mode (#20143)

Description (problem / solution / changelog)

Summary

  • scripts/whatsapp-bridge/bridge.js unconditionally dropped every fromMe message in a group chat, so self-chat-mode users could not interact with the agent in any WhatsApp group regardless of group_policy / group_allow_from / require_mention.
  • Filter logic moved into a pure shouldFilterFromMeMessage() helper. Self-chat mode now forwards group fromMe messages to the gateway so the existing Python-side group routing rules apply, while DM echo prevention and bot-mode behaviour are unchanged.
  • Echo-loop protection on forwarded messages still relies on the existing REPLY_PREFIX startsWith() and recentlySentIds checks downstream in bridge.js.

Closes #20143

Testing

  • node --test scripts/whatsapp-bridge/from-me-filter.test.mjs
✔ status broadcast fromMe is always dropped (self-chat mode) (0.860583ms)
✔ status broadcast fromMe is always dropped (bot mode) (1.064667ms)
✔ bot mode drops all fromMe messages including groups (0.114625ms)
✔ self-chat mode forwards fromMe group messages to gateway (#20143) (0.095583ms)
✔ self-chat mode forwards fromMe group messages even without sock.user identity (0.088417ms)
✔ self-chat mode forwards user own self-chat DM (classic format) (0.132625ms)
✔ self-chat mode forwards user own self-chat DM (LID format) (0.134291ms)
✔ self-chat mode drops fromMe DMs to other contacts (echo prevention) (0.069208ms)
✔ self-chat mode drops fromMe DMs when sock.user identity is missing (0.097916ms)
ℹ tests 9
ℹ pass 9
ℹ fail 0
  • node --test scripts/whatsapp-bridge/allowlist.test.mjs (existing tests still green)
ℹ tests 4
ℹ pass 4
ℹ fail 0
  • node --check scripts/whatsapp-bridge/bridge.js (parses)

Changed files

  • scripts/whatsapp-bridge/bridge.js (modified, +8/-15)
  • scripts/whatsapp-bridge/from-me-filter.js (added, +52/-0)
  • scripts/whatsapp-bridge/from-me-filter.test.mjs (added, +138/-0)

Code Example

if (msg.key.fromMe) {
    if (isGroup || chatId.includes('status')) continue;  // ← drops ALL group fromMe messages

---

if (!isSelfChat) continue;

---

-        if (isGroup || chatId.includes('status')) continue;
+        if (chatId.includes('status')) continue;

---

-        if (!isSelfChat) continue;
+        if (!isSelfChat && !isGroup) continue;
RAW_BUFFERClick to expand / collapse

Bug Description

In WhatsApp self-chat mode, the bridge (scripts/whatsapp-bridge/bridge.js) unconditionally drops all fromMe messages from group chats. This means the user cannot interact with the agent through WhatsApp groups — their own messages never reach the gateway, regardless of group_policy or group_allow_from configuration.

This affects any self-chat mode user who wants the agent to respond in WhatsApp groups.

Steps to Reproduce

  1. Set up Hermes with WhatsApp in self-chat mode
  2. Configure a group in group_allow_from with group_policy: allowlist and require_mention: false
  3. Send a message in the allowlisted group from the paired WhatsApp account
  4. Observe: message never appears in gateway.log, agent never responds

Expected Behavior

In self-chat mode, the user's own messages in allowlisted groups should pass through the bridge and reach the gateway, where group_policy / require_mention config can properly handle them. This is consistent with how non-fromMe group messages and fromMe DM messages work.

Actual Behavior

The bridge silently drops all fromMe group messages at the filtering stage, before they ever reach the gateway. No log entry is produced. The gateway has no opportunity to apply group policy.

Affected Component

  • Gateway (Telegram/Discord/Slack/WhatsApp)

Messaging Platform

WhatsApp

Debug Report

Unable to share debug report (contains private group JIDs and session data). The issue is reproducible by inspecting the bridge source code directly.

Operating System

macOS 15.4

Hermes Version

Latest main branch (commit 244ae6db, Apr 21 2026)

Root Cause Analysis

The bug is in scripts/whatsapp-bridge/bridge.js, in the fromMe message handling block:

Line ~212:

if (msg.key.fromMe) {
    if (isGroup || chatId.includes('status')) continue;  // ← drops ALL group fromMe messages

The isGroup || condition unconditionally skips group messages from the user. The intent was to prevent echo loops, but this is overly broad — it prevents ALL user group messages from reaching the gateway.

Line ~227:

if (!isSelfChat) continue;

Even if the first check is fixed, this line would block group messages in self-chat mode because groups can never match the selfChat JID comparison.

Proposed Fix

Two changes in scripts/whatsapp-bridge/bridge.js:

Change 1 — Line ~212: Remove isGroup || from the status broadcast filter:

-        if (isGroup || chatId.includes('status')) continue;
+        if (chatId.includes('status')) continue;

Status broadcasts are still correctly filtered. Group messages are now allowed through to the next check.

Change 2 — Line ~227: Allow group messages to bypass the selfChat DM check:

-        if (!isSelfChat) continue;
+        if (!isSelfChat && !isGroup) continue;

Groups are never "self-chat" by JID comparison, so they need an explicit bypass.

Safety: Echo-back prevention remains intact via:

  • REPLY_PREFIX check downstream (prevents processing agent's own replies)
  • recentlySentIds tracking (prevents re-processing recently sent messages)
  • In bot mode (WHATSAPP_MODE === 'bot'), all fromMe messages are still skipped before reaching this code

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

extent analysis

TL;DR

The issue can be fixed by modifying the scripts/whatsapp-bridge/bridge.js file to allow fromMe messages in group chats to pass through the bridge and reach the gateway.

Guidance

  • Review the proposed fix in the issue description, which involves two changes to scripts/whatsapp-bridge/bridge.js: removing the isGroup || condition and adding a bypass for group messages in the selfChat DM check.
  • Verify that the changes do not introduce any echo loops or other issues by testing the updated code with different scenarios, including group chats and self-chat mode.
  • Consider adding additional logging or debugging statements to ensure that the changes are working as expected and to help with future troubleshooting.
  • Before submitting a PR, test the changes thoroughly to ensure they fix the issue without introducing any regressions.

Example

// Change 1 — Line ~212:
if (chatId.includes('status')) continue;

// Change 2 — Line ~227:
if (!isSelfChat && !isGroup) continue;

Notes

The proposed fix seems to address the issue, but it's essential to test it thoroughly to ensure it works as expected in different scenarios. Additionally, the fix relies on the REPLY_PREFIX check, recentlySentIds tracking, and bot mode configuration to prevent echo-backs, so these mechanisms should be reviewed to ensure they are functioning correctly.

Recommendation

Apply the proposed workaround by modifying the scripts/whatsapp-bridge/bridge.js file as described, and then submit a PR for review. This approach fixes the issue while maintaining the existing safety mechanisms to prevent echo loops.

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING