hermes - ✅(Solved) Fix discord.thread_require_mention YAML key is ignored (only env var works) [3 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#23084Fetched 2026-05-11 03:31:23
View on GitHub
Comments
1
Participants
2
Timeline
9
Reactions
0
Timeline (top)
labeled ×5cross-referenced ×3commented ×1

discord.thread_require_mention: true in ~/.hermes/config.yaml is silently ignored. The gateway config loader does not forward this key into either config.extra or the DISCORD_THREAD_REQUIRE_MENTION environment variable, so _discord_thread_require_mention() always falls back to the default false.

Root Cause

gateway/config.py around lines 624–642 forwards discord.require_mention into os.environ["DISCORD_REQUIRE_MENTION"], but there is no equivalent block for thread_require_mention. Meanwhile gateway/platforms/discord.py:2712-2720:

def _discord_thread_require_mention(self) -> bool:
    configured = self.config.extra.get("thread_require_mention")
    if configured is not None:
        ...
    return os.getenv("DISCORD_THREAD_REQUIRE_MENTION", "false").lower() in ("true", "1", "yes", "on")

Reads from config.extra (never populated for this key) or the env var (never set by the loader). Result: the YAML key is dead.

Fix Action

Fix / Workaround

Workaround: set DISCORD_THREAD_REQUIRE_MENTION=true in ~/.hermes/.env — env-var path works, only the YAML key is broken.

PR fix notes

PR #23089: fix(discord): add thread_require_mention config option to gate in-thr…

Description (problem / solution / changelog)

fix(discord): add thread_require_mention config to gate in-thread responses

Add discord.thread_require_mention config option. When set to true, the bot requires @mention to respond even in threads where it previously participated. Defaults to false (existing behavior unchanged).

Closes #23084

Changed files

  • gateway/config.py (modified, +2/-0)
  • gateway/platforms/discord.py (modified, +11/-1)
  • tests/gateway/test_discord_free_response.py (modified, +31/-0)

PR #23187: fix(discord): honor thread_require_mention config

Description (problem / solution / changelog)

What does this PR do?

Restores the missing discord.thread_require_mention config path so Discord thread replies can require an explicit mention again when operators opt into that behavior.

Related Issue

Fixes #23084

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • bridge discord.thread_require_mention from gateway config into the Discord platform extra/env layer in gateway/config.py
  • add a dedicated thread mention gate in gateway/platforms/discord.py so prior bot participation only bypasses mentions when thread gating is disabled
  • extend tests/gateway/test_discord_free_response.py
  • add tests/gateway/test_discord_thread_require_mention_config.py to cover YAML/config bridging

How to Test

  1. Run UV_PYTHON=3.11 /Library/Frameworks/Python.framework/Versions/3.10/bin/uv run --frozen pytest -q -o addopts='' tests/gateway/test_discord_free_response.py tests/gateway/test_discord_thread_require_mention_config.py
  2. Run UV_PYTHON=3.11 /Library/Frameworks/Python.framework/Versions/3.10/bin/uv run --frozen ruff check gateway/config.py gateway/platforms/discord.py tests/gateway/test_discord_free_response.py tests/gateway/test_discord_thread_require_mention_config.py
  3. Confirm threads with prior bot participation still require a mention when thread_require_mention is enabled by env or config

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: macOS 15.x

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

Screenshots / Logs

  • 24 passed in 0.56s
  • ruff check passed for the touched gateway files and tests

Changed files

  • gateway/config.py (modified, +4/-0)
  • gateway/platforms/discord.py (modified, +11/-1)
  • tests/gateway/test_discord_free_response.py (modified, +36/-0)
  • tests/gateway/test_discord_thread_require_mention_config.py (added, +28/-0)

PR #23292: fix(gateway): forward discord.thread_require_mention YAML key to env var

Description (problem / solution / changelog)

Closes #23084

gateway/config.py was forwarding discord.require_mention from YAML into DISCORD_REQUIRE_MENTION but had no equivalent for thread_require_mention. This caused the YAML key to be silently ignored while the env var (DISCORD_THREAD_REQUIRE_MENTION) worked as a workaround.

Add the missing block to mirror the require_mention handling for thread_require_mention, so both YAML keys are honored with env vars taking precedence.

Changed files

  • gateway/config.py (modified, +2/-0)

Code Example

discord:
  require_mention: true
  thread_require_mention: true

---

def _discord_thread_require_mention(self) -> bool:
    configured = self.config.extra.get("thread_require_mention")
    if configured is not None:
        ...
    return os.getenv("DISCORD_THREAD_REQUIRE_MENTION", "false").lower() in ("true", "1", "yes", "on")
RAW_BUFFERClick to expand / collapse

Summary

discord.thread_require_mention: true in ~/.hermes/config.yaml is silently ignored. The gateway config loader does not forward this key into either config.extra or the DISCORD_THREAD_REQUIRE_MENTION environment variable, so _discord_thread_require_mention() always falls back to the default false.

Repro

~/.hermes/config.yaml:

discord:
  require_mention: true
  thread_require_mention: true

Restart the gateway. In a thread the bot has previously participated in, send a message with no @mention and no Discord-reply pinging the bot. Expected: bot stays silent. Actual: bot replies (the in_bot_thread bypass is still active because thread_require_mention evaluated to false).

Workaround: set DISCORD_THREAD_REQUIRE_MENTION=true in ~/.hermes/.env — env-var path works, only the YAML key is broken.

Root cause

gateway/config.py around lines 624–642 forwards discord.require_mention into os.environ["DISCORD_REQUIRE_MENTION"], but there is no equivalent block for thread_require_mention. Meanwhile gateway/platforms/discord.py:2712-2720:

def _discord_thread_require_mention(self) -> bool:
    configured = self.config.extra.get("thread_require_mention")
    if configured is not None:
        ...
    return os.getenv("DISCORD_THREAD_REQUIRE_MENTION", "false").lower() in ("true", "1", "yes", "on")

Reads from config.extra (never populated for this key) or the env var (never set by the loader). Result: the YAML key is dead.

Suggested fix

In gateway/config.py, mirror the existing require_mention handling for thread_require_mention — either push it into config.extra so the first branch picks it up, or set DISCORD_THREAD_REQUIRE_MENTION if not already in env.

Tested on hermes-agent commit b16f9d438.

Why it matters

In multi-bot Discord servers (e.g. two Hermes instances sharing a guild), the in_bot_thread bypass causes every bot that has ever replied in a thread to respond to every subsequent message, regardless of who is being addressed. thread_require_mention is the documented escape hatch for exactly this case, so users reasonably expect setting it in YAML to work.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - ✅(Solved) Fix discord.thread_require_mention YAML key is ignored (only env var works) [3 pull requests, 1 comments, 2 participants]