feat(telegram/plugin): port guest mode + buffer fixes to adapter.py - #49801
Closed
elphamale wants to merge 3 commits into
Closed
feat(telegram/plugin): port guest mode + buffer fixes to adapter.py#49801elphamale wants to merge 3 commits into
elphamale wants to merge 3 commits into
Conversation
Upstream commit 5600105 moved gateway/platforms/telegram.py → plugins/platforms/telegram/adapter.py. This applies the equivalent of PRs NousResearch#43049 / NousResearch#49116 / NousResearch#49186 to the new path: - NousResearch#43049 (guest mode): _pending_guest_queries / _guest_only_chats / _guest_reply_buffer state; send() buffer block; TypeHandler registration; _handle_guest_message_update(); on_processing_complete() answerGuestQuery flush; media-method guards for send_voice / send_image_file / send_document / send_video / send_image. - NousResearch#49116 (sender_chat): _build_message_event() uses sender_chat.id / .title when from_user is None (channel-as-user posts in groups). - NousResearch#49186 (buffer quality): tool-progress drops (expect_edits/notify flags), cursor-strip before buffering, startswith-accumulation so cumulative streaming frames replace rather than double-append. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
elphamale
force-pushed
the
fix/telegram-guest-mode-adapter
branch
from
June 20, 2026 21:00
9687e65 to
f7dfd57
Compare
PTB 22.6's Update.ALL_TYPES does not include guest_message (Bot API 10.0 field not yet in the typed layer). Telegram only delivers an update type if it is listed in allowed_updates — without this, getUpdates never returns guest_message payloads and guest mode is silently dead. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The _reconnect_polling path had a different indentation for its allowed_updates call so the previous replace_all missed it. This ensures guest_message is requested even after a network-error reconnect. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
7 tasks
6 tasks
19 tasks
Author
|
Closing as superseded by #56476/#56477. This PR was a mechanical port of #43049/#49116/#49186's logic from the old |
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.
Upstream commit 5600105 moved
gateway/platforms/telegram.py→plugins/platforms/telegram/adapter.pyas part of the plugin system migration. PRs #43049, #49116, and #49186 all targeted the old path and now conflict.This PR is the consolidated replacement, applying the same changes to the new file:
Changes
From #43049 (guest mode delivery)
_pending_guest_queries,_guest_only_chats,_guest_reply_bufferin__init__send()buffer block: routes guest-chat calls to the reply buffer instead of rejectedsendMessageTypeHandlerregistration forguest_messageupdates (Bot API 10.0 raw field)_handle_guest_message_update()handler — parses payload, storesguest_query_id, routes through normal pipelineon_processing_complete()flush — firesanswerGuestQuerywith the buffered responsesend_voice,send_image_file,send_document,send_video,send_image) return a descriptive error for guest chats where the bot can't upload filesFrom #49116 (sender_chat identity)
_build_message_event(): whenfrom_userisNone(user posting as a channel), fall back tosender_chat.id/sender_chat.titlefor user identity so auth checks match and session keys are stableFrom #49186 (buffer quality)
expect_edits/notifymetadata flag detection)▉before bufferingSupersedes #43049, #49116, #49186.