Conversation
Contributor
|
Duplicate of #23063 — both fix #23045 (Telegram document/CSV download failures dispatching an empty agent turn) with the same fail-closed approach: bounded retry/backoff on the media download plus a direct failure notice to the user instead of forwarding an empty turn. Both touch the same files ( |
Contributor
Author
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.
Summary
tests/gateway/test_telegram_documents.py.Implementation
Telegram/PTB or the network can legitimately time out while resolving
get_file()or downloading file bytes. That timeout is the trigger, but the user-visible bug is in Hermes: after the document cache path raised, the adapter logged the failure and continued tohandle_message(event)with no cached path or injected text. For CSV and other document-only inputs, that can produce an empty user turn.This change centralizes Telegram media-byte download for document uploads, retries transient failures with bounded backoff, forwards explicit read/connect/pool timeout kwargs to PTB calls, and sends a direct Telegram failure notice when all attempts fail. The failed download is not routed through the agent because there is no file path/content for the agent to inspect.
Testing
Note:
/usr/bin/python3on this macOS host is Python 3.9 and cannot import currentmainbecause the repo uses Python 3.10+ type syntax; the project venv Python 3.11 was used for verification.