hermes-agent/plugins/platforms
xxxigm 142a5751a2 gateway/telegram: prune stale DM topic binding on Thread-not-found (#31501)
Both fallback sites that currently log "Thread X not found,
retrying without message_thread_id" now also drop the
``telegram_dm_topic_bindings`` row keyed on
``(chat_id, thread_id)``:

* The streaming send loop (``send`` body) — fires on the
  second failure, after the same-thread one-shot retry confirms
  the thread really is gone (the first attempt is left alone
  because Bot API has been observed to return a transient
  "Thread not found" that recovers on immediate retry).
* The control-message helper ``_send_message_with_thread_fallback``
  (approval prompts, model picker, update prompts) — single-shot
  retry, prune unconditionally on the BadRequest match.

Without this prune, a user who deletes a Telegram DM topic in
the client keeps getting their next inbound message recovered
back to the dead thread by
``_recover_telegram_topic_thread_id`` in ``gateway/run.py``,
which walks the per-user binding list newest-first and treats
the deleted thread as authoritative.  The reproduction in the
bug report is exactly this: tool progress, approvals, activity
messages and replies all land in the wrong place until the user
manually runs DELETE on state.db.

Cleanup is best-effort — we log at INFO when it succeeds, swallow
any exception from the SessionDB call, and the user-facing send
proceeds either way.

Refs #31501
2026-06-22 12:29:05 -07:00
..
dingtalk refactor(gateway): migrate slack/dingtalk/whatsapp/matrix/feishu/telegram/wecom/email/sms adapters to bundled plugins 2026-06-20 10:26:45 -07:00
discord fix(delivery): make cron output truncation configurable + adapter-aware 2026-06-22 05:41:22 -07:00
email fix(email): mark missing-config as non-retryable + reject blank env vars (#40715) 2026-06-21 13:33:52 -07:00
feishu fix(delivery): drop env-var knob, flag all chunking adapters 2026-06-22 05:41:22 -07:00
google_chat fix: guard int(os.getenv()) casts against malformed env vars (#40598) 2026-06-07 06:14:24 -07:00
homeassistant refactor(gateway): migrate Home Assistant adapter to bundled plugin 2026-06-06 11:46:24 -07:00
irc fix: guard int(os.getenv()) casts against malformed env vars (#40598) 2026-06-07 06:14:24 -07:00
line fix(line): map inbound message types to the correct MessageType 2026-06-04 21:55:20 -07:00
matrix fix(delivery): drop env-var knob, flag all chunking adapters 2026-06-22 05:41:22 -07:00
mattermost fix(delivery): drop env-var knob, flag all chunking adapters 2026-06-22 05:41:22 -07:00
ntfy test(ntfy): cover echo-tag filter; tag standalone send path 2026-05-29 13:17:46 -07:00
photon fix(photon): detect unexpected sidecar death and trigger reconnect 2026-06-21 12:15:44 -07:00
raft fix(gateway): correct sys.path insertion in plugins to prevent cron namespace collision (#49410) 2026-06-20 20:45:12 -07:00
simplex fix(gateway): classify SimpleX non-image/non-audio files as DOCUMENT 2026-06-12 01:07:50 -07:00
slack fix(slack): split csv mention pattern fallback 2026-06-22 09:44:52 -07:00
sms refactor(gateway): migrate slack/dingtalk/whatsapp/matrix/feishu/telegram/wecom/email/sms adapters to bundled plugins 2026-06-20 10:26:45 -07:00
teams fix(delivery): drop env-var knob, flag all chunking adapters 2026-06-22 05:41:22 -07:00
telegram gateway/telegram: prune stale DM topic binding on Thread-not-found (#31501) 2026-06-22 12:29:05 -07:00
wecom refactor(gateway): migrate slack/dingtalk/whatsapp/matrix/feishu/telegram/wecom/email/sms adapters to bundled plugins 2026-06-20 10:26:45 -07:00
whatsapp fix(delivery): drop env-var knob, flag all chunking adapters 2026-06-22 05:41:22 -07:00