Bug
Telegram send path can attempt to use invalid/non-numeric reply ids as reply_to_message_id, causing delivery failures.
Symptom
Intermittent Telegram send failures with:
400: Bad Request: message to be replied not found
Root cause
In src/telegram/send.ts, replyToMessageId was truncated without validating numeric validity first. In cross-surface routing scenarios, upstream reply ids may be UUID-like/non-numeric values.
Proposed fix
Validate replyToMessageId as finite positive integer before attaching:
reply_to_message_id
reply_parameters.message_id
Otherwise, omit reply threading fields and send normally.
Sanitized logs
telegram message failed: Call to 'sendMessage' failed! (400: Bad Request: message to be replied not found)
gateway/delivery-recovery: Retry failed ... message to be replied not found
Full sanitized snippet prepared locally (no tokens/chat ids included).
Additional context
This is not specific to one account/chat; it can occur whenever a non-Telegram reply id leaks into Telegram delivery context.
Bug
Telegram send path can attempt to use invalid/non-numeric reply ids as
reply_to_message_id, causing delivery failures.Symptom
Intermittent Telegram send failures with:
400: Bad Request: message to be replied not foundRoot cause
In
src/telegram/send.ts,replyToMessageIdwas truncated without validating numeric validity first. In cross-surface routing scenarios, upstream reply ids may be UUID-like/non-numeric values.Proposed fix
Validate
replyToMessageIdas finite positive integer before attaching:reply_to_message_idreply_parameters.message_idOtherwise, omit reply threading fields and send normally.
Sanitized logs
Full sanitized snippet prepared locally (no tokens/chat ids included).
Additional context
This is not specific to one account/chat; it can occur whenever a non-Telegram reply id leaks into Telegram delivery context.