Skip to content

feat(discord): add strict mention mode - #16722

Closed
FatPigeorz wants to merge 1 commit into
NousResearch:mainfrom
FatPigeorz:fix/discord-thread-bypass-config
Closed

feat(discord): add strict mention mode#16722
FatPigeorz wants to merge 1 commit into
NousResearch:mainfrom
FatPigeorz:fix/discord-thread-bypass-config

Conversation

@FatPigeorz

@FatPigeorz FatPigeorz commented Apr 27, 2026

Copy link
Copy Markdown

Summary

  • add discord.strict_mention / DISCORD_STRICT_MENTION to mirror Slack's accepted strict-mention pattern
  • default to the current Discord behavior (strict_mention: false): previously participated threads can continue without repeated mentions
  • when strict_mention: true, require an explicit Discord bot mention for every server channel/thread message unless the channel is free-response
  • bridge the YAML config key into adapter config and env state without overriding an existing env var
  • document the new Discord option and add regression coverage for multi-bot strict routing

Background

Discord already tracked threads where the bot participated and used that state to skip mention checks for follow-up messages. That behavior was unconditional. This PR keeps it as the default for backward compatibility, while adding the same style of opt-in strict mode that Slack added in #16193 after #8019.

This matters for multi-bot / multi-agent Discord servers: explicit mentions should be able to route a turn to one bot without waking another bot just because it participated earlier in the same thread.

Closes #16725

Behavior matrix

Context Default (strict_mention: false) strict_mention: true
DM Responds Responds
Free-response channel Responds Responds
Channel/thread, explicit @mention Responds Responds
Previously participated thread, no mention Responds Ignores until re-mentioned
Unknown thread/channel, no mention Ignores Ignores

Test Plan

  • /root/.hermes/hermes-agent/venv/bin/python -m pytest tests/gateway/test_discord_free_response.py tests/gateway/test_config.py tests/gateway/test_discord_thread_persistence.py tests/gateway/test_discord_channel_controls.py -q
  • /root/.hermes/hermes-agent/venv/bin/python -m pytest tests/gateway/test_discord_free_response.py tests/gateway/test_config.py tests/gateway/test_discord_thread_persistence.py tests/gateway/test_discord_channel_controls.py tests/gateway/test_slack_mention.py -q

@FatPigeorz FatPigeorz changed the title fix(discord): honor thread participation mention gate fix(discord): add configurable thread mention bypass Apr 27, 2026
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery platform/discord Discord bot adapter labels Apr 27, 2026
@FatPigeorz
FatPigeorz force-pushed the fix/discord-thread-bypass-config branch from 865ac1c to f72896c Compare April 27, 2026 22:22
@FatPigeorz FatPigeorz changed the title fix(discord): add configurable thread mention bypass feat(discord): add strict mention mode Apr 27, 2026
@FatPigeorz

Copy link
Copy Markdown
Author

@teknium1 could you take a quick look when you have a chance?

This mirrors the already-merged Slack strict_mention behavior from #16193 / #8019, keeps Discord backward-compatible by default, and only changes routing when discord.strict_mention: true is set for multi-bot / multi-agent servers.

Summary of intended behavior:

  • default remains backward-compatible: discord.strict_mention: false
  • strict mode is opt-in for multi-bot / multi-agent Discord servers
  • when enabled, participated threads no longer bypass explicit mention routing
  • free-response channels and direct mentions still work as before
  • regression tests cover both the default path and strict path

Happy to adjust naming, scope, or tests if you prefer a different shape for the Discord adapter.

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused multi-bot Discord routing work. This is now implemented on current main under the shipped name discord.thread_require_mention / DISCORD_THREAD_REQUIRE_MENTION.

  • plugins/platforms/discord/adapter.py:6206-6214 disables the known-thread mention bypass when thread_require_mention is enabled, while retaining the existing default continuation behavior.
  • plugins/platforms/discord/adapter.py:8255-8258 bridges YAML without overriding an explicit environment setting; tests/gateway/test_config.py:564-599 covers both cases.
  • tests/gateway/test_discord_free_response.py:724-774 covers the known-thread strict gate, direct mentions, and YAML/config-extra behavior.
  • This behavior shipped in d863773c81b4d1c958b2f28b76bcd8b0809d7eac (feat(discord): add thread_require_mention for multi-bot threads) and is present in v2026.5.16.
  • This also matches the maintainer's verification on linked issue Discord known-thread participation bypass cannot be disabled #16725.

Automated hermes-sweeper review.

@teknium1 teknium1 closed this Jul 12, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jul 12, 2026
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/discord Discord bot adapter sweeper:implemented-on-main Sweeper: behavior already present on current main type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Discord known-thread participation bypass cannot be disabled

3 participants