fix(telegram): gracefully handle deleted reply targets (#3858)
* fix: add gpt-5.4-mini to Codex fallback catalog * fix(telegram): gracefully handle deleted reply targets When a user deletes their message while Hermes is processing, Telegram returns BadRequest 'Message to be replied not found'. Previously this was an unhandled permanent error causing silent delivery failure. Now clears reply_to_id and retries so the response is still delivered, matching the existing 'thread not found' recovery pattern. Inspired by PR #3231 by @heathley. Fixes #3229. --------- Co-authored-by: Clippy <clippy@grads.flow> Co-authored-by: Nigel Gibbs <heathley@users.noreply.github.com>
This commit is contained in:
@@ -762,6 +762,16 @@ class TelegramAdapter(BasePlatformAdapter):
|
||||
)
|
||||
effective_thread_id = None
|
||||
continue
|
||||
if "message to be replied not found" in err_lower and reply_to_id is not None:
|
||||
# Original message was deleted before we
|
||||
# could reply — clear reply target and retry
|
||||
# so the response is still delivered.
|
||||
logger.warning(
|
||||
"[%s] Reply target deleted, retrying without reply_to: %s",
|
||||
self.name, send_err,
|
||||
)
|
||||
reply_to_id = None
|
||||
continue
|
||||
# Other BadRequest errors are permanent — don't retry
|
||||
raise
|
||||
if _send_attempt < 2:
|
||||
|
||||
Reference in New Issue
Block a user