Let fromMe messages through in groups under self-chat mode - #15326
Closed
jscholz wants to merge 1 commit into
Closed
Let fromMe messages through in groups under self-chat mode#15326jscholz wants to merge 1 commit into
jscholz wants to merge 1 commit into
Conversation
… mode
The early-exit `if (isGroup || chatId.includes('status')) continue;` in
the fromMe branch of the messages.upsert handler was too aggressive: it
silently dropped every message you sent in any group, which makes it
impossible to @mention your own bot from a group you're in. That's a
common self-chat-mode use case (one paired number, bot addressed via
@mention alongside other humans).
This change:
- Keeps the status-broadcast skip (always correct to drop).
- Keeps bot mode's unconditional fromMe skip (separate number -> every
fromMe is a bridge echo; dropping is right).
- In self-chat mode, stops bailing on `isGroup`. Groups are now a valid
context for the user to address the bot from their paired account.
- For 1:1 chats, preserves the existing self-chat check so the bot
doesn't respond on the user's behalf in arbitrary DMs.
The echo-loop concern this guard seemed aimed at is already handled
downstream (~line 327) by the REPLY_PREFIX + recentlySentIds check,
which catches any message the bridge itself just sent. That's the real
loop-breaker; the group drop here was redundant and blocked a
legitimate flow.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 task
This was referenced Aug 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
In
scripts/whatsapp-bridge/bridge.js, thefromMebranch of themessages.upserthandler bails out on any group chat:That drops every message the paired user sends in any group, which breaks a legitimate self-chat-mode flow: a user with a single paired WhatsApp number wants to @mention their own bot from a group they're in alongside other humans (e.g. "@Mybot check my calendar"). Under the current code the bridge never sees those messages.
Use case
WHATSAPP_MODE !== 'bot'): the agent is paired to the user's own number.With this patch applied they can.
Why the guard was redundant
The echo-loop concern that seemed to motivate dropping all group
fromMemessages is already handled ~60 lines below:That check —
REPLY_PREFIX+recentlySentIds— is the real loop-breaker: it catches any message the bridge itself just sent, regardless of whether the chat is a group or a DM. The earlier blanketisGroupdrop was a second, overly broad line of defense that also blocked legitimate user input.What changes
status@broadcast-style chats unconditionally (always correct to drop).WHATSAPP_MODE === 'bot') still unconditionally skips everyfromMe— in that deployment the bridge runs on a separate number, so everyfromMereally is a bridge echo.isGroup. Groups are now a valid context for the paired user to address the bot.Diff shape
Before:
After:
Test plan
isSelfChat).REPLY_PREFIX/recentlySentIdsguard (no echo loop).fromMestill dropped (unchanged).status@broadcastmessages: still dropped (unchanged).🤖 Generated with Claude Code