feat(slack): add strict_mention mode to prevent agent-to-agent loops#14117
Closed
hhhonzik wants to merge 1 commit into
Closed
feat(slack): add strict_mention mode to prevent agent-to-agent loops#14117hhhonzik wants to merge 1 commit into
hhhonzik wants to merge 1 commit into
Conversation
When `strict_mention=true` (or env SLACK_STRICT_MENTION=true), the bot only replies to messages that explicitly @-tag it. All thread auto- engagement paths are disabled: bot-started threads, previously- mentioned threads, and active sessions are all ignored. Default is False so existing bots are unaffected. Motivation: when two Hermes agents share a thread, the previously- mentioned thread auto-trigger (slack.py:1107-1109) causes infinite acknowledgement loops — one bot acks, the other sees the ack as a thread reply, replies, and so on. Strict mode breaks the loop by requiring a fresh @mention for every response.
Collaborator
teknium1
pushed a commit
that referenced
this pull request
Apr 26, 2026
…is on Extends the strict_mention feature so an @mention in strict mode no longer persistently tags the thread as 'mentioned'. Without this, the thread's first mention would permanently auto-trigger the bot on every subsequent message — which is exactly what strict_mention is designed to prevent. Closes the agent-to-agent ack loop hole hhhonzik identified in #14117. Co-authored-by: hhhonzik <me@janstepanovsky.cz>
teknium1
pushed a commit
that referenced
this pull request
Apr 26, 2026
…is on Extends the strict_mention feature so an @mention in strict mode no longer persistently tags the thread as 'mentioned'. Without this, the thread's first mention would permanently auto-trigger the bot on every subsequent message — which is exactly what strict_mention is designed to prevent. Closes the agent-to-agent ack loop hole hhhonzik identified in #14117. Co-authored-by: hhhonzik <me@janstepanovsky.cz>
Contributor
|
Merged via #16193 — the _mentioned_threads skip you caught is included as commit 34e3763 with your authorship preserved. @ching-kaching's #12258 landed as the base (it had the helper + config bridge + test suite); your diagnosis of the agent-to-agent ack loop hole and the |
ulasbilgen
pushed a commit
to ulasbilgen/hermes-adhd-agent
that referenced
this pull request
May 1, 2026
…is on Extends the strict_mention feature so an @mention in strict mode no longer persistently tags the thread as 'mentioned'. Without this, the thread's first mention would permanently auto-trigger the bot on every subsequent message — which is exactly what strict_mention is designed to prevent. Closes the agent-to-agent ack loop hole hhhonzik identified in NousResearch#14117. Co-authored-by: hhhonzik <me@janstepanovsky.cz>
donald131
pushed a commit
to donald131/hermes-agent
that referenced
this pull request
May 2, 2026
…is on Extends the strict_mention feature so an @mention in strict mode no longer persistently tags the thread as 'mentioned'. Without this, the thread's first mention would permanently auto-trigger the bot on every subsequent message — which is exactly what strict_mention is designed to prevent. Closes the agent-to-agent ack loop hole hhhonzik identified in NousResearch#14117. Co-authored-by: hhhonzik <me@janstepanovsky.cz>
02356abc
pushed a commit
to 02356abc/hermes-agent
that referenced
this pull request
May 14, 2026
…is on Extends the strict_mention feature so an @mention in strict mode no longer persistently tags the thread as 'mentioned'. Without this, the thread's first mention would permanently auto-trigger the bot on every subsequent message — which is exactly what strict_mention is designed to prevent. Closes the agent-to-agent ack loop hole hhhonzik identified in NousResearch#14117. Co-authored-by: hhhonzik <me@janstepanovsky.cz>
dannyJ848
pushed a commit
to dannyJ848/hermes-agent
that referenced
this pull request
May 17, 2026
…is on Extends the strict_mention feature so an @mention in strict mode no longer persistently tags the thread as 'mentioned'. Without this, the thread's first mention would permanently auto-trigger the bot on every subsequent message — which is exactly what strict_mention is designed to prevent. Closes the agent-to-agent ack loop hole hhhonzik identified in NousResearch#14117. Co-authored-by: hhhonzik <me@janstepanovsky.cz>
gweeteve
pushed a commit
to gweeteve/hermes-agent
that referenced
this pull request
Jun 2, 2026
…is on Extends the strict_mention feature so an @mention in strict mode no longer persistently tags the thread as 'mentioned'. Without this, the thread's first mention would permanently auto-trigger the bot on every subsequent message — which is exactly what strict_mention is designed to prevent. Closes the agent-to-agent ack loop hole hhhonzik identified in NousResearch#14117. Co-authored-by: hhhonzik <me@janstepanovsky.cz>
Egavasyug
pushed a commit
to Egavasyug/hermes-agent
that referenced
this pull request
Jun 10, 2026
…is on Extends the strict_mention feature so an @mention in strict mode no longer persistently tags the thread as 'mentioned'. Without this, the thread's first mention would permanently auto-trigger the bot on every subsequent message — which is exactly what strict_mention is designed to prevent. Closes the agent-to-agent ack loop hole hhhonzik identified in NousResearch#14117. Co-authored-by: hhhonzik <me@janstepanovsky.cz>
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.
Summary
Adds a new
strict_mentionSlack config flag. When enabled, the bot only replies to messages that explicitly@-tag it — all forms of thread auto-engagement are disabled.Why
Currently, once a bot is
@-mentioned in a thread, slack.py:1125-1131 registers the thread in_mentioned_threadsand the bot replies to every subsequent message in that thread (regardless of mention).When two Hermes agents share a thread (e.g. one agent delegating tasks to another via Slack), this causes infinite acknowledgement loops:
@-tags Agent B with a task_bot_message_ts)✓)_mentioned_threads)✓)require_mention=truedoesn't help because it only gates the first mention — the auto-engagement paths bypass it entirely.Behavior
strict_mention=false(default)strict_mention=true@-mentions in the current message trigger a reply. Thread continuity, bot-started threads, and active sessions are all ignored. Mentions also do not register the thread in_mentioned_threads.Config
Or via env:
SLACK_STRICT_MENTION=true.Test Plan
strict_mention=false(default): existing thread auto-engagement still works (regression check)strict_mention=true: bot replies only to messages containing<@bot_uid>strict_mention=true: thread is NOT added to_mentioned_threadseven after a mention (verified by re-replying without mention → no response)free_response_channelsstill take precedence over strict modeRelated
Discovered via Planepoints agent-to-agent loop where a tester agent (
Ringo) and the primary Hermes agent ack-looped each other dozens of times in a single thread before manual intervention.