-
-
Notifications
You must be signed in to change notification settings - Fork 56.9k
Description
Slack: thread replies not detected as implicit mentions when user (not bot) starts the thread
Problem
When a user @mentions a bot in a Slack channel and the bot replies (creating a thread via replyToMode: "first"), subsequent user messages in that thread are skipped with reason: "no-mention" — even though the bot has already participated in the thread.
Root Cause
In prepareSlackMessage, the implicit mention check is:
const implicitMention = Boolean(
!isDirectMessage && ctx.botUserId && message.thread_ts &&
message.parent_user_id === ctx.botUserId
);This only triggers when the bot is the thread parent (parent_user_id === botUserId). But when a user starts a thread by @mentioning a bot, parent_user_id is the user's ID, not the bot's — even though the bot has replied in the thread.
Expected Behavior
Thread replies should be treated as implicit mentions if the bot has previously participated in that thread (i.e., has posted at least one message in it), not only if the bot started the thread.
Steps to Reproduce
- Configure a Slack bot account with
requireMention: trueandreplyToMode: "first"on a channel - User posts
@Bot let's chatin the channel - Bot replies, creating a thread ✅
- User sends a follow-up in the thread without @mentioning the bot
- Message is skipped with
no-mention❌
Suggested Fix
Replace the parent_user_id === ctx.botUserId check with a thread participation check — e.g., query the Slack conversations.replies API for the thread and check if botUserId appears in the reply authors, or track bot participation in thread sessions.
Environment
- OpenClaw v0.42.x (Pi, arm64)
- Slack Socket Mode, multi-account setup