Skip to content

fix(discord): thread explicit reply mentions - #91190

Open
LFDMcore wants to merge 2 commits into
NousResearch:mainfrom
LFDMcore:fix/discord-explicit-reply-thread-20260820
Open

fix(discord): thread explicit reply mentions#91190
LFDMcore wants to merge 2 commits into
NousResearch:mainfrom
LFDMcore:fix/discord-explicit-reply-thread-20260820

Conversation

@LFDMcore

@LFDMcore LFDMcore commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Preserve Discord: bot silently ignores quote-replies in free_response_channels #9399: an unmentioned quote-reply remains an inline continuation.
  • Treat a quote-reply with a direct Hermes mention as a new task in a thread-first channel.
  • Treat Discord's automatic reply-ping as context, not as a typed invocation.
  • Add a regression at the Discord free-response boundary that proves the emitted Hermes event targets the newly created thread, not the parent channel.

Why

The merged #11629 fix excluded every quote-reply from auto-threading to protect free-response continuations. That broad exclusion also routed an explicit @Hermes task reply into the parent channel. A direct mention is already Hermes' explicit invocation signal; this change makes that case follow the configured auto-thread route while retaining the unmentioned continuation behaviour. The adapter captures the raw <@Hermes> token before it strips display text: Discord can add the replied-to bot to message.mentions automatically, but that reply-ping alone must not create a new thread. The raw-token check runs only for reply messages, avoiding an unnecessary scan on ordinary Discord traffic.

This is intentionally narrower than #80658, which routes all eligible quote-replies through a thread and would change #9399's unmentioned free-response behaviour.

Test plan

scripts/run_tests.sh tests/gateway/test_discord_free_response.py -k explicit_mention_reply_threads_to_new_thread -q
scripts/run_tests.sh tests/gateway/test_discord_free_response.py -k reply_ping_without_inline_mention_stays_inline -q
scripts/run_tests.sh tests/gateway/test_discord_free_response.py tests/e2e/test_discord_adapter.py -q

All commands passed on the current main base (8794e5a…): 35 focused tests, Ruff on both changed files, and the Windows-footgun scan (994 files).

@alt-glitch alt-glitch added type/bug Something isn't working comp/plugins Plugin system and bundled plugins platform/discord Discord bot adapter P3 Low — cosmetic, nice to have sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages labels Aug 21, 2026
@Enough1122

Copy link
Copy Markdown
Contributor

AI code review — automated review for reference; please use your judgment.

The distinction drawn here is exactly right: a raw <@bot> token typed inside a quote-reply is a deliberate invocation (→ new thread), while a mention that materializes only through Discord's automatic reply-ping resolution is ambient context (→ stays inline). Hoisting is_reply_message/inline_mention above the display-stripping step is necessary for the raw-token check to see unmodified content, the guard ordering keeps no_thread_channels and voice-linked channels winning over the new behavior, and both directions have focused regression tests with honest docstrings.

No blocking issues found.

Nit (plugins/platforms/discord/adapter.py:~8168–8172): skip_for_reply reads as a double negative in the condition (not skip_for_reply) and inline_mention actually means "raw-token mention within a reply"; renaming to e.g. reply_without_direct_mention / reply_has_raw_mention would make this branch self-documenting for the next reader.

— reviewer-a · automated agent review (Hermes week-review)

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

Labels

comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have platform/discord Discord bot adapter sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants