hermes - ✅(Solved) Fix [Bug]: Free-response Discord channels spawn a new thread per message, contradicting documented inline-reply behavior [1 pull requests, 1 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#25310Fetched 2026-05-14 03:47:24
View on GitHub
Comments
0
Participants
1
Timeline
5
Reactions
0
Author
Participants
Timeline (top)
labeled ×4cross-referenced ×1

Root Cause

In gateway/platforms/discord.py's _handle_message, the auto-thread block computes:

skip_thread = bool(channel_ids & no_thread_channels)

This only honors DISCORD_NO_THREAD_CHANNELS. It does not honor DISCORD_FREE_RESPONSE_CHANNELS even though free-response channels are conceptually "respond inline" surfaces. The variable is_free_channel is already computed earlier in the function (line ~4365 on current main) and is just not propagated into the auto-thread gate.

Fix Action

Fixed

PR fix notes

PR #25311: fix(discord): keep free-response channels inline

Description (problem / solution / changelog)

What does this PR do?

Fix a code-vs-docs gap in Discord auto-threading. Free-response channels are documented as "skip auto-threading — reply inline," but the production code only checks DISCORD_NO_THREAD_CHANNELS when deciding whether to skip thread creation, not DISCORD_FREE_RESPONSE_CHANNELS. So every message in a free-response channel currently spawns its own thread, turning a documented "lightweight chat" channel into a thread-spawning machine.

One-line production change: OR is_free_channel into the existing skip_thread calculation.

The existing docstring for discord.free_response_channels at website/docs/user-guide/messaging/discord.md:347 already promises this behavior:

"Free-response channels also skip auto-threading — the bot replies inline rather than spinning off a new thread per message. This keeps the channel usable as a lightweight chat surface."

so no docs change is needed — this PR makes the code match the docs.

Related Issue

Fixes #25310

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)

Changes Made

  • gateway/platforms/discord.py: in _handle_message's auto-thread block, skip_thread = bool(channel_ids & no_thread_channels) becomes bool(channel_ids & no_thread_channels) or is_free_channel. The is_free_channel variable is already computed earlier in the function (used by the mention gate) — this propagates it to the auto-thread gate as well.
  • tests/gateway/test_discord_free_response.py: new regression test test_discord_free_response_channel_skips_auto_thread that mocks _auto_create_thread and asserts it is not awaited when a message arrives in a free-response channel with auto_thread=true (the default).

How to Test

To verify the bug exists without the fix:

  1. Check out main.
  2. Apply only the test addition from this PR.
  3. Run pytest tests/gateway/test_discord_free_response.py::test_discord_free_response_channel_skips_auto_thread.
  4. Expect: failure with AssertionError: Expected mock to not have been awaited. Awaited 1 times. (i.e. the production bug is real — auto-thread is fired).

To verify the fix:

  1. Apply this full PR.
  2. Run the same test — passes.
  3. Run the full tests/gateway/test_discord_free_response.py suite — 22 tests pass (was 21).

Manual verification: configure a Discord bot with discord.free_response_channels: [<channel-id>] and discord.auto_thread: true. Send any message in that channel. Before this PR: bot spawns a thread. After this PR: bot replies inline.

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits
  • I searched for existing PRs — no duplicate
  • My PR contains only changes related to this fix
  • I've run the impacted test files and all tests pass
  • I've added tests — regression test added that demonstrably fails without the fix
  • I've tested on my platform: Ubuntu 24.04

Documentation & Housekeeping

  • I've updated relevant documentation — N/A; existing docs already describe the intended behavior, this PR makes code match docs
  • cli-config.yaml.example — N/A, no config key changes
  • CONTRIBUTING.md / AGENTS.md — N/A, no architecture/workflow changes
  • Cross-platform impact — N/A, purely server-side adapter logic
  • Tool descriptions/schemas — N/A

Changed files

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

Code Example

skip_thread = bool(channel_ids & no_thread_channels)

---

skip_thread = bool(channel_ids & no_thread_channels) or is_free_channel
RAW_BUFFERClick to expand / collapse

Bug Description

DISCORD_FREE_RESPONSE_CHANNELS is intended to make a channel a lightweight chat surface — every message gets an inline reply without needing @mention. The user-facing docs at website/docs/user-guide/messaging/discord.md describe exactly this:

"Free-response channels also skip auto-threading — the bot replies inline rather than spinning off a new thread per message. This keeps the channel usable as a lightweight chat surface."

(That paragraph already exists in main; quoted from the current #### discord.free_response_channels section.)

But the production code in gateway/platforms/discord.py doesn't match: the auto-thread gate checks DISCORD_NO_THREAD_CHANNELS but not DISCORD_FREE_RESPONSE_CHANNELS. So every message in a free-response channel still triggers a brand-new thread, turning a "lightweight chat" channel into a thread-spawning machine — one thread per message.

This is a code-vs-docs gap, not a design question.

Steps to Reproduce

  1. Configure Discord adapter with discord.require_mention: true, discord.auto_thread: true (defaults), and add a channel ID to discord.free_response_channels.
  2. Send any message in that channel (no @mention needed).
  3. Observe: the bot creates a new thread named after the message and replies inside the thread.

Expected by the docs: the bot replies inline in the channel.

Expected Behavior

Free-response channels reply inline. Auto-threading is skipped for those channels (mirroring how DISCORD_NO_THREAD_CHANNELS already works).

Actual Behavior

A new thread is created on every message in a free-response channel. The "lightweight chat" surface is unusable as such — the channel fills with single-message threads.

Affected Component

Gateway (Telegram/Discord/Slack/WhatsApp)

Messaging Platform

Discord

Debug Report

This is a code-level issue reproducible from inspection of gateway/platforms/discord.pydiscord debug share won't add information beyond what's in the docs/code diff. Filing without the debug bundle.

Operating System

Ubuntu 24.04

Python Version

3.12.9

Hermes Version

Reproduced against current main (upstream/main at e2b2d4861).

Root Cause Analysis

In gateway/platforms/discord.py's _handle_message, the auto-thread block computes:

skip_thread = bool(channel_ids & no_thread_channels)

This only honors DISCORD_NO_THREAD_CHANNELS. It does not honor DISCORD_FREE_RESPONSE_CHANNELS even though free-response channels are conceptually "respond inline" surfaces. The variable is_free_channel is already computed earlier in the function (line ~4365 on current main) and is just not propagated into the auto-thread gate.

Proposed Fix

One-line addition to skip_thread:

skip_thread = bool(channel_ids & no_thread_channels) or is_free_channel

PR ready: [PR #XXX] (link will go here once posted)

Contribution

  • I'd like to fix this myself and submit a PR

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 [Bug]: Free-response Discord channels spawn a new thread per message, contradicting documented inline-reply behavior [1 pull requests, 1 participants]