Skip to content

fix: prevent Discord NO_REPLY bot loops#29932

Open
JeffreyDavidson wants to merge 1 commit into
NousResearch:mainfrom
JeffreyDavidson:fix/no-reply-bot-loop
Open

fix: prevent Discord NO_REPLY bot loops#29932
JeffreyDavidson wants to merge 1 commit into
NousResearch:mainfrom
JeffreyDavidson:fix/no-reply-bot-loop

Conversation

@JeffreyDavidson

Copy link
Copy Markdown

Summary

  • Drop Discord bot messages whose content is exactly NO_REPLY before they can enter the agent loop
  • Exclude bot NO_REPLY sentinel messages from Discord channel history backfill
  • Suppress literal NO_REPLY platform responses at delivery time
  • Add regression coverage for the Discord bot filter behavior

Why

When bot-to-bot routing is enabled with DISCORD_ALLOW_BOTS=mentions, a bot NO_REPLY sentinel can be treated as a real prompt. If the receiving agent then intentionally stays silent, the gateway can surface empty-response retries and create noisy bot-to-bot loops. NO_REPLY should behave as a control/silence token, not a user prompt.

Verification

  • ./venv/bin/python -m pytest tests/gateway/test_discord_bot_filter.py tests/gateway/test_discord_bot_auth_bypass.py -q

@alt-glitch alt-glitch added type/bug Something isn't working comp/gateway Gateway runner, session dispatch, delivery platform/discord Discord bot adapter P2 Medium — degraded but workaround exists labels May 21, 2026
zombi3butt pushed a commit to zombi3butt/hermes-agent that referenced this pull request May 21, 2026
Three-layer fix for Discord bot-to-bot silence token handling:

1. Entry filter (_handle_message): Drop Discord bot messages with content
   exactly "NO_REPLY" before they enter the agent loop. When
   DISCORD_ALLOW_BOTS=mentions, other bots' NO_REPLY must be ignored.

2. Backfill exclusion (_fetch_channel_context): Exclude NO_REPLY sentinel
   messages from channel history backfill so they don't contaminate session
   context.

3. Delivery suppression (send): Suppress literal NO_REPLY responses from
   being sent to Discord channels — it's a control/silence token, not
   user-facing content.

Fixes noisy bot-to-bot loops caused by agent silence being surfaced as
empty-response retries.
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 type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants