fix(slack): don't reply /agent help to plain channel messages (v0.141.2)#243
Merged
Conversation
A plain message in a channel the bot sits in was getting the "👋 Address an agent…" router help list. The Slack app subscribes to `message.channels` (needed so plain in-thread follow-ups reach thread continuity), which also delivers a `message` event for every channel post; a non-continuation one fell through to fireSlack → the /agent router. The socket now only starts a fresh run on an explicit @mention (app_mention) or a DM (im/mpim). A plain channel message matters only as a thread continuation, else it's dropped silently — matching Discord, whose parser already ignores non-mention guild messages. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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
Sending a plain message to a Slack channel the bot sits in (no @mention) triggered the
/agentrouter's help list:This should only happen on an explicit @mention or a DM.
Root cause
The Slack app subscribes to
message.channelsso that plain in-thread follow-up replies reach thread-continuity (documented in CLAUDE.md). But that subscription also delivers amessageevent for every post in a channel the bot is in.parseSlackEventaccepts anymessage, and indispatcha non-continuation one fell straight throughcontinueSlackThread(→none) intofireSlack→routeChat, which posts the help list for an unaddressed message.Discord never had this bug —
parseDiscordMessagealready returnsnullfor a guild message that doesn't @-mention the bot.Fix
After the thread-continuity check, only start a fresh run on an explicit @mention (
app_mention) or a DM (im/mpim). A plain channelmessagenow matters only as a thread continuation; otherwise it's dropped silently. Brings Slack to parity with Discord.Verification
npm run typecheck✓npm run build✓npm run test:governance→ 68/68 ✓🤖 Generated with Claude Code