Conversation
When auto_rename_topics: true is set under platforms.telegram.extra in config.yaml, Hermes automatically renames Telegram forum topics to match the session title. This fires in two cases: 1. After the auto-generated title is set (first exchange) 2. When the user manually sets a title via /title Only applies to Telegram forum topics (sessions with a thread_id). Requires the bot to be admin in the supergroup. Changes: - agent/title_generator.py: add on_title_set callback - gateway/platforms/telegram.py: add rename_forum_topic method - gateway/run.py: wire up callback for auto-title and manual /title - tests/gateway/test_auto_rename_topics.py: 9 new tests - tests/agent/test_title_generator.py: update assertion for new kwarg - website/docs/user-guide/messaging/telegram.md: feature docs
|
Would love to see this implemented/merged. As Telegram topics become a core way to organize Hermes conversations — especially now that private-chat topics are first-class in the Bot API — keeping the visible Telegram topic name in sync with the generated/manual session title feels pretty important. Without this, the actual Hermes session title and the Telegram sidebar drift apart, which makes topic-heavy usage much harder to scan. This PR looks like the right product behavior to me. |
|
I applied the code changes in this PR to my Hermes Agent, but I noticed threads don't always auto rename for me. I asked my agent to help identify and fix the bug, and it identified an issue in the auto-title callback path.
This is fixable by passing the gateway loop from the caller ( Targeted local check passed: Cherry-pickable commit from my repo: |
|
What I would actually like to see is the other way around. Match the session title to the Forum Topic title. When creating a new topic in the Telegram supergroup a session is also started and the title is based on the first messages. Instead the session title should match the topic title! This makes much more sense than the other way around where my telegram topics would rename to some random session title based on a message. |
|
Thanks for the Telegram topic-title synchronization work. Current Automated hermes-sweeper review evidence:
|
What does this PR do?
Automatically renames Telegram forum topics to match the session title when
auto_rename_topics: trueis set in config. This keeps topic lists scannable — instead of generic names like "General" or "Topic 3", each topic shows what the conversation is actually about.Fires in two cases:
/titleRelated Issue
No specific issue, but closely related to:
This bridges the gap between "session has a title" and "Telegram topic reflects that title."
Type of Change
Changes Made
agent/title_generator.py: Addedon_title_setcallback toauto_title_session()andmaybe_auto_title(). Fires after title is stored. Decoupled from platform code.gateway/platforms/telegram.py: Addedrename_forum_topic()method (callseditForumTopicBot API) and_is_auto_rename_topics_enabled()config check.gateway/run.py: Added_make_title_rename_callback()(thread-safe for auto-title background thread) and_rename_topic_for_source()(async helper for manual/title). Both only activate when platform=Telegram, thread_id exists, and config flag is set.website/docs/user-guide/messaging/telegram.md: Full documentation section for the feature.tests/gateway/test_auto_rename_topics.py: 9 new tests.tests/agent/test_title_generator.py: Updated 1 assertion for new kwarg.How to Test
~/.hermes/config.yaml:/title My Custom Name— topic should rename immediately.Checklist
Code
feat(telegram):)pytestand all tests pass (51 passed, 0 failed)Documentation & Housekeeping
website/docs/user-guide/messaging/telegram.md)cli-config.yaml.example— N/A (config lives in userconfig.yamlunderplatforms.telegram.extra)CONTRIBUTING.md/AGENTS.md— N/A (no architecture changes)