Skip to content

fix(discord): auto-thread cluster — free-response + reply + fallback + mention-name-strip - #11629

Merged
teknium1 merged 5 commits into
mainfrom
hermes/hermes-5b03d077
Apr 17, 2026
Merged

fix(discord): auto-thread cluster — free-response + reply + fallback + mention-name-strip#11629
teknium1 merged 5 commits into
mainfrom
hermes/hermes-5b03d077

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Unified salvage of three complementary PRs plus one of our own fixes, all addressing overlapping issues in Discord auto-threading. Determinism preserved — no new config modes, just bug fixes.

Fixes #9399, fixes #8487, fixes #6336.

What this fixes

Bug Symptom Fix
#9399 (@zeejaytan) Quote-replies in free_response_channels silently dropped Reply messages skip auto-thread (they stay inline)
#9399 (same) Every free-response message spawned a noisy thread free_response_channels ALWAYS skip auto-thread
#8487 (@eosinchen) After first auto-thread in a channel, subsequent mentions ignored Fallback path when message.create_thread() direct call rejects
#6336 (@anpicasso) Thread names showed raw <@&id> / <#id> markers Strip all three mention patterns before building thread name

Commits (authorship preserved for each salvaged fix)

  1. 4933f7a0fix(discord): free-response channels skip auto-threading (@Hypn0sis, salvaged from PR fix(discord): implement smart auto-thread mode, free-response channels skip threading #9650; the bundled auto_thread: smart mode from that PR was dropped in favor of deterministic true/false — no new config modes)
  2. 95b43c17fix(discord): skip auto-threading reply messages + config.extra fallback for require_mention / free_response_channels (@OwenYWT, from PR fix(discord): skip auto-threading reply messages #9624)
  3. c57a0052fix(discord): fall back when auto-thread creation fails (@sgaofen, from PR fix(discord): add auto-thread fallback path #8692 — channel.send + seed.create_thread when direct path rejects)
  4. d94f7cabfix(discord): strip mention syntax from auto-thread names (ours — closes Discord auto-thread names show raw role mention IDs #6336)
  5. d9a66e0cchore(release): map @Hypn0sis and @OwenYWT to AUTHOR_MAP

Tests

New regression cases added by the cherry-picks + our follow-ups:

pytest tests/gateway/ -k discord → 244/244 passed.

E2E validation (real discord.py 2.7.1)

Verified live:

  • Thread names strip <@&id>, <@id>, <#id><@&1490963422786093149> <@555> please help <#123>please help
  • Mention-only content → falls back to Hermes default
  • Direct message.create_thread() raise → fallback via channel.send() + seed.create_thread() with proper reason string
  • config.extra['free_response_channels'] list read correctly without env var
  • Env-var fallback still works when config.extra unset

Not addressed by this PR (separate concerns)

Hypn0sis and others added 5 commits April 17, 2026 06:35
Free-response channels already bypassed the @mention gate so users could
chat inline with the bot, but auto-threading still fired on every
message — spinning off a thread per message and defeating the
lightweight-chat purpose.

Fix: fold `is_free_channel` into `skip_thread` so threading is skipped
whenever the channel is in DISCORD_FREE_RESPONSE_CHANNELS (via env or
discord.free_response_channels in config.yaml).

Net change: one line in _handle_message + one regression test.

Partially addresses #9399. Authored by @Hypn0sis (salvaged from PR #9650;
the bundled 'smart' auto-thread mode from that PR was dropped in favor
of deterministic true/false semantics).
Previously a message like `<@&1490963422786093149> help` would spawn a
thread literally named `<@&1490963422786093149> help`, exposing raw
Discord mention markers in the thread list. Only user mentions
(`<@id>`) were being stripped upstream — role mentions (`<@&id>`) and
channel mentions (`<#id>`) leaked through.

Fix: strip all three mention patterns in `_auto_create_thread` before
building the thread name. Collapse runs of whitespace left by the
removal. If the entire content was mention-only, fall back to 'Hermes'
instead of an empty title.

Fixes #6336.

Tests: two new regression guards in test_discord_slash_commands.py
covering mixed-mention content and mention-only content.
@teknium1
teknium1 merged commit c7334b4 into main Apr 17, 2026
5 checks passed
@teknium1
teknium1 deleted the hermes/hermes-5b03d077 branch April 17, 2026 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants