Skip to content

fix: require @-mention for follow-up replies#6

Merged
rayhanadev merged 1 commit into
mainfrom
require-mention-for-followups
May 30, 2026
Merged

fix: require @-mention for follow-up replies#6
rayhanadev merged 1 commit into
mainfrom
require-mention-for-followups

Conversation

@rayhanadev

Copy link
Copy Markdown
Member

What

Pookie no longer responds to thread follow-ups automatically. It now requires an explicit @-mention to reply.

Why

Previously, once Pookie was engaged in a thread (via a mention or DM), it would answer every subsequent human reply:

  • onSubscribedMessage handled all follow-ups in subscribed threads, mention or not.
  • The onNewMessage catch-all also answered non-mention replies whenever the bot had previously participated in the thread.

This made Pookie chime in on conversations between humans that happened to occur in a thread it had once been pinged in.

How

Per the Chat SDK event model, threads stay subscribed (so future mentions still route to onSubscribedMessage), but the bot only responds when explicitly addressed:

  • Added an isSlackBotAddressed helper in message-routing.ts that checks message.isMention, with a raw-text scan fallback. The fallback is needed because the Slack adapter only sets isMention=true for app_mention-typed events, and Slack's app_mention/message dedupe race can drop that flag.
  • onSubscribedMessage and the onNewMessage catch-all now both gate on isSlackBotAddressed and return early otherwise.
  • DMs (onDirectMessage) are intentionally left unchanged — they are direct 1:1 conversations where requiring a mention makes no sense.
  • Removed the now-dead isTopLevelSlackMessage / hasBotParticipatedInThread helpers, the subscribeForFallback path, and their tests; added coverage for isSlackBotAddressed.

Testing

  • pnpm typecheck
  • pnpm test (275 tests) ✅
  • pnpm lint
  • pnpm format:check

Slack Thread

Open in Web Open in Cursor 

Pookie previously answered every reply in any thread it had been engaged
in, because onSubscribedMessage handled all follow-ups and the onNewMessage
catch-all responded to non-mention replies whenever the bot had participated
in the thread.

Per the Chat SDK event model, threads stay subscribed but the bot now only
responds when explicitly addressed: onSubscribedMessage and the catch-all
both gate on a new isSlackBotAddressed helper (message.isMention with a raw
text-scan fallback for the app_mention/message dedupe race). DMs are
unchanged since they are direct 1:1 conversations.

Removes the now-dead isTopLevelSlackMessage / hasBotParticipatedInThread
helpers and the subscribeForFallback path.

Co-authored-by: Ray Arayilakath <me@rayhanadev.com>
@vercel

vercel Bot commented May 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pookie Ready Ready Preview, Comment May 29, 2026 11:42pm
pookiebot Error Error May 29, 2026 11:42pm

@rayhanadev

Copy link
Copy Markdown
Member Author

bugbot run

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 6ebad81. Configure here.

@rayhanadev rayhanadev changed the title Require @-mention for follow-up replies fix: require @-mention for follow-up replies May 30, 2026
@rayhanadev rayhanadev merged commit 7b573da into main May 30, 2026
8 of 10 checks passed
@rayhanadev rayhanadev deleted the require-mention-for-followups branch May 30, 2026 20:03
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.

3 participants