fix(bitrix24): skip native-group mention gate for Open Channel sessions#1296
Merged
clark-cant merged 1 commit intoJun 28, 2026
Conversation
…ns [B24:2794] Follow-up to nextlevelbuilder#1295. After scoping the Open Channel mention gate by connector, customer messages on 1-to-1 connectors (Facebook Messenger, Zalo OA, …) were STILL being silently dropped — by the second mention-gate stanza further down in handleMessage, which checks the channel-level c.RequireMention() flag without distinguishing Open Channel traffic from native group chats (CRM deal/task chats). For a channel like nguyen-dao-openline configured with RequireMention=true, the flow was: 1. isOpenChannel block → shouldRequireMentionForOpenline("facebook|...") returns false (facebook isn't in the whitelist) → no drop. 2. isGroup block (isOpenChannel implies isGroup) → c.RequireMention()=true AND mentioned=false → DROP. Net effect: the gate-by-connector decision was overridden one stanza later, and every Facebook customer turn disappeared. Fix: scope the drop check inside the isGroup block to native-group chats only (!isOpenChannel). Open Channel sessions already own their mention policy in the earlier isOpenChannel block; re-applying the channel-level RequireMention flag here second-guesses that decision. Importantly, the text-processing that follows the drop check (MessageOriginal fallback, stripMention, bxConvertUserMentionsToReadable) stays unconditional, so an Open Channel STAFF turn that does come in with "[USER=<botID>]Bot[/USER]" BBCode still gets cleaned up the same way it always did. The only thing the new guard suppresses is the drop itself. Verified live: Facebook Messenger customer turn (IS_CONNECTOR=Y, CHAT_ENTITY_ID=facebook|34|…) now reaches the agent loop and the bot replies, matching the intent from nextlevelbuilder#1295. Surface parity: backend-only. No API contract / web UI / CLI change.
clark-cant
approved these changes
Jun 28, 2026
clark-cant
left a comment
Contributor
There was a problem hiding this comment.
Approved. Clean follow-up to #1295 — the second mention-gate stanza was overriding the connector-scoped decision from the upstream gate, silently dropping customer turns on 1-to-1 connectors (Facebook, Zalo OA, etc.) via Open Channel.
The fix is minimal (+11/-1), well-documented, and correctly scopes the drop check to native group chats only while keeping text processing unconditional. CI green, live-verified.
Risk: Low. Backend-only, no API/contract change.
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.
Problem
Follow-up to #1295. After scoping the Open Channel mention gate by connector, customer messages on 1-to-1 connectors (Facebook Messenger, Zalo OA, …) are still being silently dropped — by the second mention-gate stanza further down in
handleMessage, which checks the channel-levelc.RequireMention()flag without distinguishing Open Channel traffic from native group chats (CRM deal/task chats).For a channel like
nguyen-dao-openlineconfigured withRequireMention=true, the flow was:isOpenChannelblock →shouldRequireMentionForOpenline("facebook|…")returnsfalse(facebook isn't in the whitelist) → no drop.isGroupblock (isOpenChannelimpliesisGroup) →c.RequireMention()=trueANDmentioned=false→ DROP.Net effect: the gate-by-connector decision from #1295 was overridden one stanza later, and every Facebook customer turn disappeared. Reproduced live: customer sends "alo" from the Facebook Open Channel, payload arrives at goclaw (
mime=audio/mpegnot relevant; same for plain text), and the bot stays silent.Fix
Scope the drop check inside the
isGroupblock to native-group chats only (!isOpenChannel). Open Channel sessions already own their mention policy in the earlierisOpenChannelblock; re-applying the channel-levelRequireMentionflag here second-guesses that decision.Importantly, the text-processing that follows the drop check (
MessageOriginalfallback,stripMention,bxConvertUserMentionsToReadable) stays unconditional, so an Open Channel staff turn that does come in with[USER=<botID>]Bot[/USER]BBCode still gets cleaned up the same way it always did. The only thing the new guard suppresses is the drop itself.Verification
Live-tested against
tamgiac.bitrix24.comafter deploying a local image build:IS_CONNECTOR=Y,CHAT_ENTITY_ID=facebook|34|…) now reaches the agent loop. Bot replies, matching the intent from feat(bitrix24): scope Open Channel mention gate to group-style connectors only #1295.@mentionstill drops at the earlier gate — no regression.@mentionstill drop here when channelRequireMention=true— no regression.Surface parity
Backend-only. No API contract / web UI / CLI change.
[B24:2794]