Conversation
… mode (NousResearch#20143) The bridge unconditionally dropped every ``fromMe`` message in a group chat, so a self-chat-mode user could not interact with the agent in any WhatsApp group regardless of ``group_policy`` / ``group_allow_from`` / ``require_mention`` configuration. Their own messages were filtered at the bridge before the gateway ever got a chance to evaluate routing. The fix splits the filter rules into a pure ``shouldFilterFromMeMessage`` helper: - status broadcasts → still dropped - bot mode → still drops all fromMe (separate-number echo prevention) - self-chat mode + group → forwarded to gateway (group_policy decides) - self-chat mode + DM → only the user's own self-chat passes (existing echo prevention for DMs to other contacts is preserved) Echo-loop protection on forwarded fromMe group messages remains intact through the existing REPLY_PREFIX startsWith() and recentlySentIds checks downstream in bridge.js. Closes NousResearch#20143
|
Following up from the review on #30288: agreed that the bridge-level self-chat fix belongs here rather than in a duplicate PR. The only non-overlapping bit from #30288 is adapter-side env allowlist parity:
I verified the small adapter/docs/test change locally against this PR head: If helpful, I can open a small follow-up PR targeting this branch, but I won't paste a large patch inline here. |
teknium1
left a comment
There was a problem hiding this comment.
Thanks for isolating the original self-chat group-routing problem. It is still present on current main: scripts/whatsapp-bridge/bridge.js:549 continues every fromMe group message before the self-chat branch, while gateway/platforms/whatsapp_common.py:348-380 already contains the downstream group-policy and mention gates.
Problems
- The submitted helper returns
truefor all bot-mode fromMe messages (scripts/whatsapp-bridge/from-me-filter.js:38). Current main now has an opt-in bot-mode owner-message route atscripts/whatsapp-bridge/bridge.js:558-591; introducing the helper as an early continue would bypass that route. - The surrounding handler has moved since this PR's base, so this needs conflict-aware salvage rather than a mechanical application. Open PR #62889 contains the narrower current-context adjustment to the group/status and self-chat identity guards.
Suggested changes
- Preserve current bot-mode handling; change only the self-chat group conditions so eligible groups proceed to existing gateway policy checks.
- Cover that current dispatch path with a regression test.
This is an automated hermes-sweeper review.
|
|
||
| // Bot mode: bridge runs as a separate WhatsApp number, so every fromMe | ||
| // message is necessarily an echo of our own outgoing reply. | ||
| if (mode === 'bot') return true; |
There was a problem hiding this comment.
On current main, bot-mode fromMe events may reach the opt-in classifyOwnerMessageGate() path in bridge.js:558-591. Returning true here before that branch would bypass it entirely; keep the current bot-mode branch outside this self-chat filter when salvaging.
Summary
scripts/whatsapp-bridge/bridge.jsunconditionally dropped everyfromMemessage in a group chat, so self-chat-mode users could not interact with the agent in any WhatsApp group regardless ofgroup_policy/group_allow_from/require_mention.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.REPLY_PREFIXstartsWith() andrecentlySentIdschecks downstream in bridge.js.Closes #20143
Testing