Skip to content

feat(gateway): Slack thread replies without @mentions#5558

Closed
jarvisxyz wants to merge 1 commit into
NousResearch:mainfrom
jarvisxyz:2026-04-06.eizus.slack-thread-auto-reply
Closed

feat(gateway): Slack thread replies without @mentions#5558
jarvisxyz wants to merge 1 commit into
NousResearch:mainfrom
jarvisxyz:2026-04-06.eizus.slack-thread-auto-reply

Conversation

@jarvisxyz

Copy link
Copy Markdown
Contributor

Summary

Enables the Slack gateway to process thread replies without requiring explicit @bot mentions when there is an active conversation session.

Problem

Currently, the Slack adapter filters out all channel messages that don't contain an @mention of the bot. This breaks the natural conversation flow in threads — users expect to reply in a thread and continue the discussion without repeatedly tagging the bot.

Solution

Modified SlackAdapter._handle_slack_message() to:

  1. Detect when a message is a reply in a thread (thread_ts differs from ts)
  2. Check if there's an active session for that thread/user combination
  3. If a session exists, process the message without requiring an @mention
  4. If no session exists, maintain existing behavior (ignore unless mentioned)

Changes

  • gateway/platforms/base.py: Added set_session_store() method to BasePlatformAdapter
  • gateway/platforms/slack.py: Added _has_active_session_for_thread() and updated mention logic
  • gateway/run.py: Inject session store into adapters during initialization and reconnection
  • tests/gateway/test_slack.py: Added 5 new tests covering thread reply scenarios

Testing

All 69 Slack gateway tests pass, including 5 new tests specifically for thread reply handling:

  • Thread replies without mention + no session → ignored
  • Thread replies without mention + active session → processed
  • Thread replies with mention → processed, mention stripped
  • Top-level messages → still require mention
  • No session store attached → falls back to mention-required

Backwards Compatibility

Fully backwards compatible:

  • Existing @mention behavior unchanged
  • Only adds new capability for thread contexts with active sessions
  • Falls back to requiring mention if session store unavailable or thread has no session,

When a user replies in a Slack thread where the bot has an active
conversation session, the bot now processes the message even without
an explicit @mention. This improves UX for ongoing threaded
discussions.

Changes:
- Added set_session_store() to BasePlatformAdapter for adapters to
  check active sessions
- Modified SlackAdapter to detect thread replies and check if a
  session exists for that thread before requiring @mentions
- Updated GatewayRunner to inject the session store into adapters
- Added comprehensive tests for the new behavior

Fixes: Thread replies without @jarvis are now processed if there is
an active session, matching user expectations for conversation flow
jarvisxyz pushed a commit to jarvisxyz/hermes-agent that referenced this pull request Apr 6, 2026
The edit_message method was sending raw content directly to Slack's
chat_update API without converting standard markdown to Slack's mrkdwn
format. This caused broken formatting and malformed URLs (e.g., trailing
** from bold syntax became part of clickable links → 404 errors).

The send() method already calls format_message() to handle this conversion,
but edit_message() was bypassing it. This change ensures edited messages
receive the same markdown → mrkdwn transformation as new messages.

Closes: PR NousResearch#5558 formatting issue where links had trailing markdown syntax.
jarvisxyz added a commit to jarvisxyz/hermes-agent that referenced this pull request Apr 6, 2026
The edit_message method was sending raw content directly to Slack's
chat_update API without converting standard markdown to Slack's mrkdwn
format. This caused broken formatting and malformed URLs (e.g., trailing
** from bold syntax became part of clickable links → 404 errors).

The send() method already calls format_message() to handle this conversion,
but edit_message() was bypassing it. This change ensures edited messages
receive the same markdown → mrkdwn transformation as new messages.

Closes: PR NousResearch#5558 formatting issue where links had trailing markdown syntax.

Co-authored-by: eizus <hello@cdr.xyz>
@teknium1

teknium1 commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

Closing as duplicate of #5579 (same feature, same author). Will review #5579 separately. Thanks!

@teknium1 teknium1 closed this Apr 6, 2026
teknium1 pushed a commit that referenced this pull request Apr 7, 2026
The edit_message method was sending raw content directly to Slack's
chat_update API without converting standard markdown to Slack's mrkdwn
format. This caused broken formatting and malformed URLs (e.g., trailing
** from bold syntax became part of clickable links → 404 errors).

The send() method already calls format_message() to handle this conversion,
but edit_message() was bypassing it. This change ensures edited messages
receive the same markdown → mrkdwn transformation as new messages.

Closes: PR #5558 formatting issue where links had trailing markdown syntax.
teknium1 pushed a commit that referenced this pull request Apr 7, 2026
The edit_message method was sending raw content directly to Slack's
chat_update API without converting standard markdown to Slack's mrkdwn
format. This caused broken formatting and malformed URLs (e.g., trailing
** from bold syntax became part of clickable links → 404 errors).

The send() method already calls format_message() to handle this conversion,
but edit_message() was bypassing it. This change ensures edited messages
receive the same markdown → mrkdwn transformation as new messages.

Closes: PR #5558 formatting issue where links had trailing markdown syntax.
Tommyeds pushed a commit to Tommyeds/hermes-agent that referenced this pull request Apr 12, 2026
The edit_message method was sending raw content directly to Slack's
chat_update API without converting standard markdown to Slack's mrkdwn
format. This caused broken formatting and malformed URLs (e.g., trailing
** from bold syntax became part of clickable links → 404 errors).

The send() method already calls format_message() to handle this conversion,
but edit_message() was bypassing it. This change ensures edited messages
receive the same markdown → mrkdwn transformation as new messages.

Closes: PR NousResearch#5558 formatting issue where links had trailing markdown syntax.
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
The edit_message method was sending raw content directly to Slack's
chat_update API without converting standard markdown to Slack's mrkdwn
format. This caused broken formatting and malformed URLs (e.g., trailing
** from bold syntax became part of clickable links → 404 errors).

The send() method already calls format_message() to handle this conversion,
but edit_message() was bypassing it. This change ensures edited messages
receive the same markdown → mrkdwn transformation as new messages.

Closes: PR NousResearch#5558 formatting issue where links had trailing markdown syntax.
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
The edit_message method was sending raw content directly to Slack's
chat_update API without converting standard markdown to Slack's mrkdwn
format. This caused broken formatting and malformed URLs (e.g., trailing
** from bold syntax became part of clickable links → 404 errors).

The send() method already calls format_message() to handle this conversion,
but edit_message() was bypassing it. This change ensures edited messages
receive the same markdown → mrkdwn transformation as new messages.

Closes: PR NousResearch#5558 formatting issue where links had trailing markdown syntax.
olympus-terminal pushed a commit to olympus-terminal/hermes-agent that referenced this pull request May 16, 2026
The edit_message method was sending raw content directly to Slack's
chat_update API without converting standard markdown to Slack's mrkdwn
format. This caused broken formatting and malformed URLs (e.g., trailing
** from bold syntax became part of clickable links → 404 errors).

The send() method already calls format_message() to handle this conversion,
but edit_message() was bypassing it. This change ensures edited messages
receive the same markdown → mrkdwn transformation as new messages.

Closes: PR NousResearch#5558 formatting issue where links had trailing markdown syntax.
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
The edit_message method was sending raw content directly to Slack's
chat_update API without converting standard markdown to Slack's mrkdwn
format. This caused broken formatting and malformed URLs (e.g., trailing
** from bold syntax became part of clickable links → 404 errors).

The send() method already calls format_message() to handle this conversion,
but edit_message() was bypassing it. This change ensures edited messages
receive the same markdown → mrkdwn transformation as new messages.

Closes: PR NousResearch#5558 formatting issue where links had trailing markdown syntax.
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
The edit_message method was sending raw content directly to Slack's
chat_update API without converting standard markdown to Slack's mrkdwn
format. This caused broken formatting and malformed URLs (e.g., trailing
** from bold syntax became part of clickable links → 404 errors).

The send() method already calls format_message() to handle this conversion,
but edit_message() was bypassing it. This change ensures edited messages
receive the same markdown → mrkdwn transformation as new messages.

Closes: PR NousResearch#5558 formatting issue where links had trailing markdown syntax.
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