Skip to content

feat(discord): auto-rename thread after first bot reply - #29814

Closed
rafilajhh wants to merge 2 commits into
NousResearch:mainfrom
rafilajhh:feat/discord-auto-rename-thread
Closed

rafilajhh wants to merge 2 commits into
NousResearch:mainfrom
rafilajhh:feat/discord-auto-rename-thread

Conversation

@rafilajhh

Copy link
Copy Markdown

Summary

Auto-rename Discord threads to a short LLM-generated title after the first bot response, mirroring Telegram's rename_dm_topic behaviour.

Changes

  • gateway/platforms/discord.py: Add _auto_rename_thread() method that accepts either a raw user message or a pre-generated title string (already_titled=True path used by the title pipeline). Silently swallows errors (permission denied, rate-limit) since renaming is best-effort.
  • gateway/run.py: Hook _discord_title_callback into the existing maybe_auto_title pipeline so Discord threads get renamed after the first exchange, same as Telegram topics.
  • tools/discord_tool.py: Add edit_thread action for manual thread renaming via the discord tool.

How it works

  1. User sends first message in a Discord thread
  2. Bot processes and replies as normal
  3. After reply, maybe_auto_title fires in background (non-blocking)
  4. LLM generates a short 3-7 word title from the first exchange
  5. _discord_title_callback calls _auto_rename_thread with the generated title
  6. Discord API PATCH renames the thread

Requirements

Bot needs MANAGE_THREADS permission in the server.

Uses the existing maybe_auto_title pipeline to rename Discord threads
to a short LLM-generated title after the first bot response, mirroring
Telegram's rename_dm_topic behaviour.

Changes:
- gateway/platforms/discord.py: add _auto_rename_thread() method that
  accepts either a raw user message or a pre-generated title string
  (already_titled=True path used by the title pipeline)
- gateway/run.py: hook _discord_title_callback into maybe_auto_title
  so Discord threads get renamed after the first exchange, same as
  Telegram topics
- tools/discord_tool.py: add edit_thread action for manual thread
  renaming via the discord tool
@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have platform/discord Discord bot adapter comp/gateway Gateway runner, session dispatch, delivery labels May 21, 2026
@alt-glitch

Copy link
Copy Markdown
Contributor

Duplicate of #18430 (tracking issue for Discord thread auto-rename). Multiple prior closed PRs implement the same feature: #16059, #18429, #24311, #27800. See also open #15757 and #29432.

Add concrete bad/good examples to steer the LLM away from generic
titles like 'User Conversation with AI' toward specific topic-based
titles like 'Obsidian Vault Structure Review'.
@rafilajhh

Copy link
Copy Markdown
Author

Closing — implementation incomplete per tracking issue #18430. Missing config toggle (discord.auto_rename_threads) and guard for Hermes-created threads only. Will resubmit with proper spec compliance.

@rafilajhh rafilajhh closed this May 21, 2026
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 P3 Low — cosmetic, nice to have platform/discord Discord bot adapter type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants