Skip to content

fix(discord): add config-backed auto-thread channels - #54285

Open
jeeves-assistant wants to merge 53 commits into
NousResearch:mainfrom
jeeves-assistant:fix/discord-force-auto-thread-channels
Open

fix(discord): add config-backed auto-thread channels#54285
jeeves-assistant wants to merge 53 commits into
NousResearch:mainfrom
jeeves-assistant:fix/discord-force-auto-thread-channels

Conversation

@jeeves-assistant

@jeeves-assistant jeeves-assistant commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Reworks the original env-only DISCORD_FORCE_AUTO_THREAD_CHANNELS patch into the config-first shape proposed by fix: restored Discord free-response auto-thread override #27651: discord.auto_thread_channels / DISCORD_AUTO_THREAD_CHANNELS.
  • Allows selected discord.free_response_channels to still auto-create per-conversation threads for top-level posts.
  • Keeps discord.no_thread_channels as the stronger hard opt-out.
  • Ports the behavior to the current bundled Discord plugin (plugins/platforms/discord/adapter.py), adds default config/example/docs coverage, and documents the relation to free-response auto-threading.
  • Refreshed the branch against current upstream main after the Discord channel-key matching changes; auto_thread_channels now participates in the same ID/name/#name key matching path as the other Discord channel gates.

Relationship to #27651

This PR is intentionally the current-codebase port/synthesis of the older #27651 idea. #27651 had the better API shape (discord.auto_thread_channels) but targeted stale Discord paths; this branch now applies that design to the current plugin implementation.

Tests

  • python -m py_compile plugins/platforms/discord/adapter.py hermes_cli/config.py
  • python -m pytest tests/gateway/test_discord_channel_controls.py tests/gateway/test_discord_free_response.py tests/gateway/test_discord_slash_auth.py -q -o 'addopts='
  • python -m pytest tests/gateway/test_discord_edit_message_overflow.py tests/gateway/test_discord_pending_text_batch_shutdown.py tests/gateway/test_typing_indicator_toggle.py -q -o 'addopts='
  • git diff --check

@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/plugins Plugin system and bundled plugins platform/discord Discord bot adapter duplicate This issue or pull request already exists labels Jun 28, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Duplicate of #49726 — verified same mechanism: this adds a DISCORD_FORCE_AUTO_THREAD_CHANNELS set and rewrites skip_thread = ... or (is_free_channel and not force_thread) in plugins/platforms/discord/adapter.py, identical to #49726's force_thread_channels knob (the earliest open/canonical PR in this cluster, with tests). #52718 was already marked a duplicate of #49726. #52802 takes a different config knob (free_response_thread_channels) and is a related competing approach, not the same mechanism. Tracking the auto-thread-for-free-response feature under #49726.

@jeeves-assistant jeeves-assistant changed the title fix(discord): allow forced auto-thread channels fix(discord): add config-backed auto-thread channels Jun 29, 2026
@jeeves-assistant

Copy link
Copy Markdown
Contributor Author

Updated this PR so it no longer carries the Rob-specific/env-only DISCORD_FORCE_AUTO_THREAD_CHANNELS shape. It now implements the older #27651 design as discord.auto_thread_channels / DISCORD_AUTO_THREAD_CHANNELS in the current bundled Discord plugin, with docs and config-bridge coverage. That makes this PR a current-codebase port/synthesis of #27651 rather than a separate competing API.

…o-thread-channels

# Conflicts:
#	plugins/platforms/discord/adapter.py
…nels' into fix/discord-force-auto-thread-channels
…o-thread-channels

# Conflicts:
#	plugins/platforms/discord/adapter.py
…o-thread-channels

# Conflicts:
#	tests/gateway/test_discord_channel_controls.py
…o-thread-channels

# Conflicts:
#	plugins/platforms/discord/adapter.py
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Related to #49726, but not a duplicate after the update: this branch now implements the config-first discord.auto_thread_channels contract on the current plugin path rather than the earlier env-only force_thread_channels approach.

@alt-glitch alt-glitch added the backend/local Local shell execution label Aug 7, 2026
@alt-glitch alt-glitch added comp/cli CLI entry point, hermes_cli/, setup wizard backend/local Local shell execution and removed backend/local Local shell execution labels Aug 10, 2026
@Enough1122

Copy link
Copy Markdown
Contributor

AI code review — automated review for reference, author can ignore or act on any point.

fix(discord): add config-backed auto-thread channels

  1. plugins/platforms/discord/adapter.py (_handle_message, ~line 8145-8147): the "*" in auto_thread_channels wildcard is the documented headline feature but has no test coverage — only exact-channel-ID cases are pinned (test_auto_thread_channel_overrides_free_response). Please add a "*" test that also asserts no_thread_channels still wins as the hard opt-out.
  2. Dual source-of-truth precedence is subtle: _discord_auto_thread_channels() reads self.config.extra first, but the YAML path never populates extra["auto_thread_channels"]_apply_yaml_config bridges YAML → DISCORD_AUTO_THREAD_CHANNELS env var, so YAML-configured deployments always take the env fallback; the extra branch only fires when PlatformConfig is built with an explicit extra= dict (i.e., in tests). It works, but consider collapsing to a single source so the two paths can't drift.
  3. Minor: force_auto_thread is computed for every incoming message even when the channel is not a free-response channel (where the value is irrelevant). Computing it lazily inside the is_free_channel branch would make the intent clearer.

@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Related to #27651 and #82354: this revised PR adds the distinct config-backed auto_thread_channels behavior and is no longer the former env-only duplicate of closed #49726.

@alt-glitch alt-glitch added the backend/local Local shell execution label Aug 16, 2026
@alt-glitch alt-glitch removed the backend/local Local shell execution label Aug 18, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Related: this refreshed config-backed discord.auto_thread_channels implementation differs from closed #49726's env-only force_thread_channels approach, and overlaps the broader threading-semantics change in #82354. It is not marked duplicate.

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/cli CLI entry point, hermes_cli/, setup wizard comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have platform/discord Discord bot adapter sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants