fix: reduce Telegram log spam from polling and conflict errors (#10027) - #10046
Merged
Soulter merged 1 commit intoSep 14, 2026
Merged
Conversation
…otDevs#10027) Telegram long-polling floods the log in two ways: 1. python-telegram-bot performs getUpdates through httpx, which logs every request at INFO level. httpx/httpcore were missing from LogManager._NOISY_LOGGER_LEVELS, so those per-request lines (one every ~10s) leaked through. 2. _on_polling_error logged a full traceback for every polling error, including non-network errors such as Conflict (two bot instances polling the same token). Log a concise one-line message for non-network errors and keep the traceback only for NetworkError, which still needs it for recovery.
kilisamemarisaaa
approved these changes
Sep 11, 2026
kilisamemarisaaa
left a comment
There was a problem hiding this comment.
Reviewed head 48bb8eb. Non-network polling errors still return before recovery accounting and now emit a concise message without exc_info, while NetworkError keeps traceback logging and the existing rebuild-threshold path. I also verified the noisy logger configuration sets httpx/httpcore child loggers to WARNING without suppressing warnings or errors. The Telegram adapter tests (29), API logger tests (6), full Ruff checks, and the repository CI matrix are green. I found no correctness blocker.
5 tasks
Soulter
approved these changes
Sep 14, 2026
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.
Problem
The Telegram adapter floods the log in two ways:
python-telegram-botperformsgetUpdatesthroughhttpx, and httpx logs every request at INFO level.httpx/httpcorewere missing fromLogManager._NOISY_LOGGER_LEVELS, so those per-request lines (one every ~10s) leaked into the log._on_polling_errorlogged a full traceback for every polling error, including non-network errors such asConflict(which happens when two bot instances poll the same token).Fix
httpxandhttpcoreto_NOISY_LOGGER_LEVELSso their request-level logging is suppressed._on_polling_error, log a concise one-line message for non-network errors and keep the full traceback only forNetworkError, which still needs it for the recovery logic.Notes
The
409 Conflictitself is caused by two bot instances polling the same token and is not an AstrBot bug; this change only stops it from spamming a full traceback.Closes #10027
Summary by Sourcery
Bug Fixes: