Skip to content

fix(discord): name missing privileged intents and stop reconnect loop - #79448

Closed
astraltrekkin wants to merge 1 commit into
NousResearch:mainfrom
astraltrekkin:fix/discord-privileged-intents-error-79430
Closed

astraltrekkin wants to merge 1 commit into
NousResearch:mainfrom
astraltrekkin:fix/discord-privileged-intents-error-79430

Conversation

@astraltrekkin

@astraltrekkin astraltrekkin commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

When Discord rejects the gateway WebSocket with PrivilegedIntentsRequired, Hermes previously logged discord.py's vague message and kept reconnecting forever (hundreds of attempts). That error is a Developer Portal config problem, not a transient network blip.

This PR:

  1. Detects PrivilegedIntentsRequired on connect and logs/stores an actionable fatal that names the intent(s) Hermes is actually requesting (always Message Content; Server Members only when username/role allowlists need it), with a Developer Portal fix path and docs link.
  2. Marks that fatal as non-retryable so the gateway drops Discord from the reconnect queue instead of spinning.
  3. Teaches interactive_setup() to call out Privileged Gateway Intents before asking for the bot token (the wizard previously only said "create a bot at …").
  4. Corrects docs troubleshooting that told users to enable all three privileged intents including Presence (Hermes does not request Presence).

Related Issue

Fixes #79430

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

  • plugins/platforms/discord/adapter.py — helpers for members-intent need / PrivilegedIntents detection / guidance text; connect() sets privileged_intents_required non-retryable fatal; interactive_setup() prints intent requirements before the token prompt
  • tests/gateway/test_discord_connect.py — unit coverage for guidance text, members-intent rules, and connect → non-retryable fatal on PrivilegedIntentsRequired
  • tests/gateway/test_discord_plugin_setup.py — setup wizard must mention Message Content / Privileged Gateway Intents
  • website/docs/user-guide/messaging/discord.md — troubleshooting section aligned with the real error and Hermes's actual intent requests

How to Test

  1. Unit (mocked failure path):
    scripts/run_tests.sh tests/gateway/test_discord_connect.py tests/gateway/test_discord_plugin_setup.py -q
    Expect the new PrivilegedIntents / setup guidance tests to pass.
  2. Reproduce the old failure class (portal intents off): with Message Content Intent disabled in the Developer Portal, start the gateway and confirm logs name Message Content Intent (and Server Members if applicable), fatal / non-retryable behavior, and no endless Reconnect discord (attempt N) loop.
  3. Happy path (intents enabled): enable Message Content Intent (and Server Members if using usernames/DISCORD_ALLOWED_ROLES), restart the gateway, confirm Discord connects and can send/receive in a test channel.

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 (Darwin 25)

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

Before (reporter, #79430): opaque PrivilegedIntentsRequired + Reconnect discord (attempt 438)...

After (unit-simulated PrivilegedIntents path): non-retryable fatal with guidance naming Message Content Intent + Developer Portal / docs links.

Happy-path live check: patched DiscordAdapter.connect() succeeded and posted to the test guild channel with intents enabled.

PrivilegedIntentsRequired is a Developer Portal config error; surface which
intents Hermes requested as a non-retryable fatal and teach setup/docs.

Co-authored-by: Cursor <cursoragent@cursor.com>
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/plugins Plugin system and bundled plugins platform/discord Discord bot adapter area/config Config system, migrations, profiles labels Aug 5, 2026
teknium1 added a commit that referenced this pull request Aug 13, 2026
The cherry-picked #79448 predated #85049's _classify_connect_exception,
so it added a parallel PrivilegedIntentsRequired branch ahead of the
classifier (plus its own _is_privileged_intents_required detector).
Fold the tailored guidance into the classifier's existing intents arm
instead: one classification path, one error code (discord_intents_required),
and the message now names exactly the intents Hermes requested (Message
Content always; Server Members only when username/role allowlists need it).
Wizard callout, docs corrections, and tests from #79448 kept as-is.
@teknium1

Copy link
Copy Markdown
Collaborator

Merged via PR #85108 (#85108) — your commit was cherry-picked onto current main with your authorship preserved in git history. Thanks for a genuinely user-centered fix: the members-intent predicate, the tailored guidance text, the wizard callout, and catching the docs telling people to enable Presence Intent were all kept.

One adaptation during salvage: #85049 landed a type-based connect classifier (_classify_connect_exception) after your branch was cut, so your PrivilegedIntentsRequired handling was folded into that classifier's intents arm (code discord_intents_required) instead of running as a parallel pre-classifier branch. Your guidance text is what users now see, verbatim.

skappafrost pushed a commit to skappafrost/hermes-agent that referenced this pull request Aug 15, 2026
The cherry-picked NousResearch#79448 predated NousResearch#85049's _classify_connect_exception,
so it added a parallel PrivilegedIntentsRequired branch ahead of the
classifier (plus its own _is_privileged_intents_required detector).
Fold the tailored guidance into the classifier's existing intents arm
instead: one classification path, one error code (discord_intents_required),
and the message now names exactly the intents Hermes requested (Message
Content always; Server Members only when username/role allowlists need it).
Wizard callout, docs corrections, and tests from NousResearch#79448 kept as-is.
bobaba76 pushed a commit to bobaba76/hermes-agent that referenced this pull request Aug 27, 2026
The cherry-picked NousResearch#79448 predated NousResearch#85049's _classify_connect_exception,
so it added a parallel PrivilegedIntentsRequired branch ahead of the
classifier (plus its own _is_privileged_intents_required detector).
Fold the tailored guidance into the classifier's existing intents arm
instead: one classification path, one error code (discord_intents_required),
and the message now names exactly the intents Hermes requested (Message
Content always; Server Members only when username/role allowlists need it).
Wizard callout, docs corrections, and tests from NousResearch#79448 kept as-is.
melon-xf added a commit to melon-xf/hermes-agent that referenced this pull request Sep 3, 2026
The cherry-picked NousResearch#79448 predated NousResearch#85049's _classify_connect_exception,
so it added a parallel PrivilegedIntentsRequired branch ahead of the
classifier (plus its own _is_privileged_intents_required detector).
Fold the tailored guidance into the classifier's existing intents arm
instead: one classification path, one error code (discord_intents_required),
and the message now names exactly the intents Hermes requested (Message
Content always; Server Members only when username/role allowlists need it).
Wizard callout, docs corrections, and tests from NousResearch#79448 kept as-is.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Config system, migrations, profiles comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have platform/discord Discord bot adapter type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Discord Gateway Privileges Failure - Followed Hermes Gateway Setup 1:1

3 participants