Skip to content

handle app mention events for workspaces that don't deliver message.channels - #12193

Closed
yunyunyunyun-yun wants to merge 1 commit into
NousResearch:mainfrom
yunyunyunyun-yun:slack-memtion-fix
Closed

handle app mention events for workspaces that don't deliver message.channels#12193
yunyunyunyun-yun wants to merge 1 commit into
NousResearch:mainfrom
yunyunyunyun-yun:slack-memtion-fix

Conversation

@yunyunyunyun-yun

Copy link
Copy Markdown

What does this PR do?

Fixes a silent message-handling failure where the Slack gateway completely ignores @mention messages on Enterprise Grid workspaces.

When a user @mentions the bot in a channel, Slack delivers an app_mention event. The previous code registered handle_app_mention as an intentional no-op, assuming Slack would also deliver a duplicate message event that the existing handle_message_event handler would catch. However, some workspaces (notably Enterprise Grid installs) only deliver app_mention and do not send a corresponding message.channels event — causing all @mentions to be silently dropped with no response, no reaction, and no log output.

The fix forwards app_mention events to the existing _handle_slack_message handler. The timestamp-based deduplicator already present in _handle_slack_message prevents double-processing in workspaces that do deliver both events.

Related Issue

Fixes #

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)

Changes Made

  • gateway/platforms/slack.py: Changed handle_app_mention from a no-op to forwarding the event to _handle_slack_message(event), matching the behavior of handle_message_event.

How to Test

  1. Set up a Slack app with Socket Mode enabled and app_mention event subscriptions
  2. Configure SLACK_BOT_TOKEN, SLACK_APP_TOKEN, and SLACK_ALLOWED_USERS in ~/.hermes/.env
  3. Run hermes gateway run -v
  4. In a Slack channel where the bot is a member, send @ hello
  5. Before fix: bot produces no reaction, no response, no log output after the mention
  6. After fix: bot adds 👀 reaction and responds to the message

To verify deduplication works correctly on workspaces that deliver both events: confirm the bot does not reply twice when both app_mention and message.channels events arrive.

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes
  • I've tested on my platform: macOS 15

Documentation & Housekeeping

  • I've updated relevant documentation — N/A (no docs needed for this bug fix)
  • I've updated cli-config.yaml.example — N/A
  • I've updated CONTRIBUTING.md or AGENTS.md — N/A
  • I've considered cross-platform impact — fix is platform-agnostic (Slack API behavior)
  • I've updated tool descriptions/schemas — N/A

Screenshots / Logs

Before fix — app_mention routed to no-op, bot stays silent:
DEBUG slack_bolt.AsyncApp: Checking listener: handle_message_event ...
DEBUG slack_bolt.AsyncApp: Checking listener: handle_app_mention ...
DEBUG slack_bolt.AsyncApp: Running listener: handle_app_mention ...
DEBUG slack_bolt.AsyncApp: Responding with status: 200 body: ""

← bot silent, no reaction, no response

After fix

app_mention forwarded to _handle_slack_message, bot responds normally.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists platform/slack Slack app adapter comp/gateway Gateway runner, session dispatch, delivery labels Apr 23, 2026
@kshitijk4poor

Copy link
Copy Markdown
Collaborator

Already fixed on current main via PR #18198, which changed the handler from to forwarding to with ts-based dedup. Thanks for reporting this!

@kshitijk4poor

Copy link
Copy Markdown
Collaborator

Already fixed on current main via PR #18198, which changed the app_mention handler from pass to forwarding to _handle_slack_message with ts-based dedup. Thanks for reporting this!

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

Labels

comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists platform/slack Slack app adapter type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants