fix(cron): centralize Telegram private topic delivery#42051
Open
stepanov1975 wants to merge 1 commit into
Open
fix(cron): centralize Telegram private topic delivery#42051stepanov1975 wants to merge 1 commit into
stepanov1975 wants to merge 1 commit into
Conversation
442ea56 to
8c92915
Compare
8c92915 to
cda0dc1
Compare
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.
What does this PR do?
Fixes Telegram private DM-topic cron delivery by moving the Telegram-specific private-topic routing semantics into the shared gateway delivery layer instead of keeping them in cron or the standalone
send_messagepath.Cron still preserves the user's delivery target shape, but it now delegates named Telegram private-topic metadata preparation and stale-topic recovery to shared helpers in
gateway/delivery.py. This avoids silently falling back to the root DM when a private-topic send is stale or unsafe.The important behavior changes are:
ensure_dm_topic(..., force_create=True)instead of falling back to standalone/root-chat deliveryThis is related to the narrower open cron fix PR #23249, but takes a shared delivery-router approach instead of adding only a
send_message_tool.pyretry branch.Related Issue
Fixes #22773.
Related to #23249, #33375, #35739, and #31501 as adjacent Telegram DM-topic routing failures.
Type of Change
Changes Made
gateway/delivery.pyensure_dm_topic(..., force_create=True)cron/scheduler.pytools/send_message_tool.pychat_id:thread_idsends without router metadatatests/cron/test_scheduler.pytests/tools/test_send_message_tool.pyHow to Test
Reproduction before the fix:
Proof after the fix:
send_messagerejects ambiguous positive private-chat thread sends before trying Telegram, while supergroup/forum thread targets still send.Automated verification run on this branch:
Full
pytest tests/ -qwas not run for this PR; the verification above covers the touched gateway, cron, and send-message paths.Tested platform: Linux 6.8.0-117-generic, Python 3.11.15.
Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests pass — focused suite run above insteadDocumentation & Housekeeping
docs/, docstrings) — N/A; internal delivery behavior onlycli-config.yaml.exampleif I added/changed config keys — N/A; no config keys changedCONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — N/AScreenshots / Logs
Focused test output: