feat(discord): semantic thread titles for auto-created threads - #56792
Closed
rungmc357 wants to merge 1 commit into
Closed
feat(discord): semantic thread titles for auto-created threads#56792rungmc357 wants to merge 1 commit into
rungmc357 wants to merge 1 commit into
Conversation
Contributor
|
Merged via #60187 - your commit was cherry-picked onto current main with your authorship preserved in git log, plus a small follow-up making the title sanitizers UTF-16-safe. Your implementation was chosen from six competing PRs for having the right scoping guard (auto_thread_created + only_if_current_name) at the right size. Thanks! |
This was referenced Jul 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When Hermes auto-creates a Discord thread from a mention, the thread gets a
fast placeholder name derived from the raw message content (first 80 chars
with mention syntax stripped). This is the same pattern Telegram already has
for forum topics — but Discord threads keep that placeholder forever.
This PR adds the Discord equivalent of the existing Telegram
_rename_telegram_topic_for_session_titleflow:_auto_create_threadtags the created thread with_hermes_auto_thread_initial_name(the placeholder name)SessionSourcegainsauto_thread_createdandauto_thread_initial_namefields so the gateway can distinguishHermes-created threads from pre-existing or human-renamed ones
session title, the gateway schedules a best-effort
adapter.rename_thread()that renames only threads whose current namestill matches the original placeholder — so human-renamed threads are
never overwritten
rename_threadon the Discord adapter is guarded withonly_if_current_nameto prevent clobberingThis mirrors the Telegram topic rename path (
_is_telegram_topic_lane→_schedule_telegram_topic_title_rename→_rename_telegram_topic_for_session_title) and reuses the sametitle_callbackhook inmaybe_auto_title.Changes
gateway/session.py: Addauto_thread_created/auto_thread_initial_nametoSessionSource(dataclass + serialization)gateway/platforms/base.py: Pass new fields through_make_session_sourceplugins/platforms/discord/adapter.py: Extract_derive_auto_thread_name,tag created threads with initial name, add
rename_threadmethod withonly_if_current_nameguardgateway/run.py: Add_is_discord_auto_thread_lane,_sanitize_discord_thread_title,_rename_discord_auto_thread_for_session_title,_schedule_discord_semantic_thread_rename; wire the title callback forDiscord auto-thread lanes
tests/gateway/test_discord_slash_commands.py: Tests for auto-threadconfig bridge
tests/gateway/test_fast_command.py: Tests for fast-command dispatch onauto-thread lanes
Test plan
python -m pytest tests/gateway/test_discord_slash_commands.py \ tests/gateway/test_fast_command.py -o 'addopts=' -qAll 43 tests pass.