Skip to content

fix(spam): a messenger thread filed by a fixed rule notifies no one - #1113

Open
mortondev wants to merge 1 commit into
fix/cold-spam-no-signalsfrom
fix/messenger-spam-files-before-notify
Open

mortondev wants to merge 1 commit into
fix/cold-spam-no-signalsfrom
fix/messenger-spam-files-before-notify

Conversation

@mortondev

@mortondev mortondev commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Stacked on #1101 (cold email filed by a fixed rule raises no signals): this PR uses its fixedSpamSignalFor and signalsChecked, 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

  • The fixed spam rules for a new Messenger thread now run before the thread exists, as fix(spam): cold email filed by a fixed rule raises no signals #1101 does for cold email. A thread they file is created already in Spam (closed, filed by the burst rule), and nothing else happens: no team email or bell, no created or message event, no inbox update, no routing, no AI agent turn. The visitor's send still succeeds and they see the conversation as closed, the same as when the AI classifier files a thread today.
  • The sender the burst rule counts on is the visitor's own real address, or else the one they gave before the chat. An anonymous visitor's placeholder address never counts.
  • The AI classifier still runs after the create, and skips the fixed rules, so the burst counter moves once per thread.
  • The new-message bell rereads the conversation and bells no one when it is in Spam. This covers a thread the AI classifier files after the event was raised.

Tests

  • messenger-spam-no-signals.db.test.ts runs 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

@mortondev
mortondev added this pull request to stack #1114 November 19, 2026 12:43
@mortondev
mortondev force-pushed the fix/messenger-spam-files-before-notify branch from b113243 to 923aade Compare November 19, 2026 15:17
@mortondev
mortondev force-pushed the fix/messenger-spam-files-before-notify branch from 923aade to 4a38f17 Compare November 19, 2026 18:57
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
mortondev force-pushed the fix/messenger-spam-files-before-notify branch from 4a38f17 to 78a0b02 Compare November 19, 2026 19:06

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant