Repository navigation
Conversation
Log the transport exception type for outgoing media timeouts and keep the original SDK error for callers.
Contributor
There was a problem hiding this comment.
Hey - I've reviewed your changes and they look great!
Linked issues
#11028 [Feature] Telegram 适配器未暴露媒体上传超时(media_write_timeout),大视频在弱上行网络下固定 20 秒写入超时 · 1 of 3 met
| # | Requirement | Status | Notes |
|---|---|---|---|
| 1 | Allow users to adjust the media upload write timeout through configuration. | ❌ Not addressed | The change adds timeout logging but does not add a timeout setting or pass a configured request to the Telegram application. |
| 2 | Keep the default media write timeout at 20.0 seconds. | ✅ Met | The application still uses the SDK's default request configuration, so the existing 20-second media write timeout is unchanged. |
| 3 | Explain in the dashboard hint that increasing the timeout may keep sending tasks occupied longer and queue later messages. | ❌ Not addressed | No dashboard configuration entry or hint is added. |
Sourcery assessment
Approved.
This was referenced Nov 8, 2026
This branch has not been deployed
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 #11028 by adding the error detail requested in the maintainer's comment. The SDK reports both a stalled upload and a response read timeout as
TimedOut, which leaves the transport phase missing from AstrBot's media send logs.Modifications / 改动点
WriteTimeoutorReadTimeout, for normal and streamed Telegram media sends.Screenshots or Test Results / 运行截图或测试结果
The regression tests use a real
ExtBotandHTTPXRequestwith a local mock transport and a temporary video. All four cases reached a multipartsendVideorequest and failed on the missing log on master. After the fix they verify the phase, the preserved exception cause and the absence of the dummy token from the AstrBot error log.Validation used Python 3.12.16 and python-telegram-bot 22.8 on macOS. The transport was simulated locally.
Checklist / 检查清单
AI disclosure: Codex generated the patch and ran the checks.
Summary by Sourcery
Improve Telegram media timeout diagnostics by logging the transport phase without exposing sensitive request details.
Bug Fixes:
Tests: