hermes-agent/website/docs/user-guide/messaging
teknium1 08130a26f6 fix(telegram): follow @username renames and support non-"bot" handles
Renaming a Telegram bot's @username in BotFather silently stopped the
gateway from answering in groups.

PTB caches getMe() in Bot._bot_user and only rewrites it inside get_me(),
so after a rename the adapter kept comparing mentions against the OLD
handle. The exclusive-mention gate then saw the new @handle, failed to
match itself, and concluded the message was addressed to a different bot
— dropping it before the reply and wake-word fallbacks could run. Native
replies to the bot were discarded too. Polling mode recovered on the next
90s heartbeat; webhook mode never calls get_me() again, so it stayed dead
until restart.

Separately, the bot-handle pattern assumed every bot username ends in
"bot". Collectible (Fragment) usernames can be assigned to bots and drop
that suffix (@jarvis, @pic), so such a bot could not recognise its own
handle in the entity-less fallback and was suppressed by any message that
also named another bot.

- Route every mention comparison through _current_bot_username(), which
  prefers the last observed handle over PTB's cache.
- Learn the live handle from inbound updates: Telegram stamps the current
  username on our own messages and on reply_to_message. Guarded by user
  id, so another account's handle is never adopted.
- Re-check identity out of band (TTL-bounded, one getMe per 5 min) when
  the exclusive gate is about to drop a message — the exact stale-handle
  symptom — so the mistake self-corrects instead of persisting.
- Refresh identity in webhook mode via a dedicated low-frequency loop,
  cancelled on the same teardown fence as the heartbeat.
- Match our own handle by identity rather than shape. Foreign handles keep
  the deliberate "...bot" narrowing so human @handles still never act as
  routing hints (the intent behind ce4d857021).

Validation: 11 regression tests; sabotage runs confirm each behavioral
test fails with the fix reverted. 157 tests green across the Telegram
gating, reconnect, and topic-mode suites.
2026-07-26 11:50:34 -07:00
..
_category_.json
bluebubbles.md
dingtalk.md fix(gateway): bridge nested DingTalk allowed_users into auth env 2026-07-20 05:39:24 -07:00
discord.md fix(discord): harden reconnect message recovery 2026-07-18 14:01:33 -07:00
email.md
feishu.md
google_chat.md docs(gateway): document typing_status_text on the Google Chat page 2026-07-18 12:28:59 -07:00
homeassistant.md
index.md docs: describe active-turn redirect busy-input behavior 2026-07-22 12:10:58 -05:00
irc.md
line.md
matrix.md fix(matrix): correct platform hint over-claims, add regression tests + docs 2026-07-20 11:10:49 -07:00
mattermost.md
msgraph-webhook.md
ntfy.md
open-webui.md chore(scripts): drop Open WebUI local bootstrap script (#56178) 2026-07-01 01:30:40 -07:00
photon.md
qqbot.md
raft.md
signal.md
simplex.md
slack.md feat(slack): support long app descriptions in the manifest generator 2026-07-23 12:01:24 -07:00
sms.md
teams-meetings.md
teams.md
telegram.md fix(telegram): follow @username renames and support non-"bot" handles 2026-07-26 11:50:34 -07:00
webhooks.md feat(gateway): add webhook payload filters 2026-07-08 08:10:55 -07:00
wecom-callback.md
wecom.md
weixin.md
whatsapp-cloud.md docs(links): update moved Cloudflare Tunnel docs URL 2026-07-20 00:56:31 -07:00
whatsapp.md
yuanbao.md