Repository navigation
Conversation
mortondev
force-pushed
the
fix/messenger-spam-files-before-notify
branch
from
November 19, 2026 15:17
b113243 to
923aade
Compare
mortondev
force-pushed
the
fix/messenger-spam-files-before-notify
branch
from
November 19, 2026 18:57
923aade to
4a38f17
Compare
A new messenger thread was notified to the team (email and bell), sent to the inbox, routed and given its created and message events before the spam filter ran, so a thread the burst rule filed still reached the team. The fixed rules now run before the thread exists, and a thread they file is filed in its insert and raises nothing, as cold email does. The AI classifier still runs after the create. The new-message bell also checks, on the conversation as it is now, that it is not in Spam, which covers a thread the classifier files after the event was raised.
mortondev
force-pushed
the
fix/messenger-spam-files-before-notify
branch
from
November 19, 2026 19:06
4a38f17 to
78a0b02
Compare
This branch has not been deployed
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.
Stacked on #1101 (cold email filed by a fixed rule raises no signals): this PR uses its
fixedSpamSignalForandsignalsChecked, and targets its branch until it merges.What was wrong
When a visitor started a new Messenger conversation, the team was told about it first and the spam filter ran afterwards. The thread was emailed and belled to the team, shown in the inbox, routed to an agent, and given its created and message events (webhooks, workflows, SLA clock). Only then did the spam filter run. So a thread that the burst rule (one sender opening threads faster than a person types) filed to Spam had already reached the team.
The new-message bell also never checked whether the conversation was in Spam.
What changed
Tests
messenger-spam-no-signals.db.test.tsruns real rate buckets on Postgres. Three threads from one sender each notify the team and raise their events; this is the control. The fourth is filed in Spam by the burst rule with no notification, no events, no inbox publish, no AI call and no waiting clock. On the base branch the fourth thread was filed but had already notified the team.notification-scope.db.test.ts(new case): over real rows, a conversation filed as Spam after its message event gets no bell, and bells again once restored. This failed on the base branch.Notes for review
sendVisitorMessage. With this PR, the check before the insert is the only place the burst rule runs for Messenger. When rebasing either one onto the other, that check must pass the visitor's principal (fix(spam): the burst rule files messenger visitors who open threads in a burst #1100'ssenderPrincipalId) tofixedSpamSignalFor, or fix(spam): the burst rule files messenger visitors who open threads in a burst #1100's rule stops working for visitors with no address.