fix(telegram): gracefully handle deleted reply targets - #3231
Closed
heathley wants to merge 1 commit into
Closed
Conversation
When a user deletes their message while Hermes is processing (race condition), Telegram returns `BadRequest: Message to be replied not found`. This was previously uncaught — causing silent delivery failure instead of the message being delivered without threading. Fix: catch TelegramBadRequest with that error text in the send() retry loop, clear reply_to_id, and let the next attempt deliver the message unthreaded. No message is lost. Closes NousResearch#3229
heathley
force-pushed
the
fix/telegram-reply-target-deleted-2
branch
from
March 26, 2026 17:00
aedf071 to
f31b925
Compare
teknium1
pushed a commit
that referenced
this pull request
Mar 30, 2026
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.
teknium1
added a commit
that referenced
this pull request
Mar 30, 2026
* 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>
Contributor
|
Merged via #3858. Your fix was adapted to fit the current main's existing BadRequest handling pattern (isinstance check inside the _NetErr catch) rather than a separate except clause. Same behavior, consistent with the 'thread not found' recovery already there. Authorship preserved. Thanks @heathley! |
angelburgosrosado
pushed a commit
to angelburgosrosado/hermes-agent
that referenced
this pull request
Apr 27, 2026
…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 NousResearch#3231 by @heathley. Fixes NousResearch#3229. --------- Co-authored-by: Clippy <clippy@grads.flow> Co-authored-by: Nigel Gibbs <heathley@users.noreply.github.com>
02356abc
pushed a commit
to 02356abc/hermes-agent
that referenced
this pull request
May 14, 2026
…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 NousResearch#3231 by @heathley. Fixes NousResearch#3229. --------- Co-authored-by: Clippy <clippy@grads.flow> Co-authored-by: Nigel Gibbs <heathley@users.noreply.github.com>
gweeteve
pushed a commit
to gweeteve/hermes-agent
that referenced
this pull request
Jun 2, 2026
…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 NousResearch#3231 by @heathley. Fixes NousResearch#3229. --------- Co-authored-by: Clippy <clippy@grads.flow> Co-authored-by: Nigel Gibbs <heathley@users.noreply.github.com>
waefrebeorn
pushed a commit
to waefrebeorn/slermes
that referenced
this pull request
Jul 2, 2026
…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 NousResearch#3231 by @heathley. Fixes NousResearch#3229. --------- Co-authored-by: Clippy <clippy@grads.flow> Co-authored-by: Nigel Gibbs <heathley@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3229
Race condition: user deletes their message while Hermes processes → Telegram returns BadRequest: Message to be replied not found → previously uncaught, delivery silently failed.
Fix: catch TelegramBadRequest with that specific message in the send() retry loop, clear reply_to_id, retry without threading. Message is always delivered.