Problem
When running multiple Hermes profiles with separate Telegram bots that share the same Telegram user ID, the session_key collides across bots.
Current behavior:
- Bot A (profile: musk) receives message from user
→ session_key = agent:main:telegram:dm:{user_id}
- Bot B (profile: astock) receives message from same user
→ session_key = agent:main:telegram:dm:{user_id} (collision)
Since build_session_key() in gateway/session.py uses only chat_id for Telegram DMs (no bot identifier), the same Telegram user talking to two different bots on the same Hermes instance produces identical session_keys.
Expected behavior:
Each bot should have isolated session state even when talking to the same user. The session_key should include bot identity so that:
- Bot A →
agent:main:telegram:bot:{bot_token_hash}:dm:{user_id}
- Bot B →
agent:main:telegram:bot:{bot_token_hash}:dm:{user_id}
Problem
When running multiple Hermes profiles with separate Telegram bots that share the same Telegram user ID, the session_key collides across bots.
Current behavior:
→ session_key =
agent:main:telegram:dm:{user_id}→ session_key =
agent:main:telegram:dm:{user_id}(collision)Since
build_session_key()ingateway/session.pyuses onlychat_idfor Telegram DMs (no bot identifier), the same Telegram user talking to two different bots on the same Hermes instance produces identical session_keys.Expected behavior:
Each bot should have isolated session state even when talking to the same user. The session_key should include bot identity so that:
agent:main:telegram:bot:{bot_token_hash}:dm:{user_id}agent:main:telegram:bot:{bot_token_hash}:dm:{user_id}