fix(gateway): preserve media + reply payload when /queue defers a turn - #55960
Merged
Conversation
/queue rebuilt the queued MessageEvent with only text/type/source/ message_id/channel_prompt, silently dropping any photo, document, voice, or reply context attached to the command. The deferred turn then ran with the attachment lost. Carry the full payload through, and accept a /queue that has media but no prompt text (e.g. "/queue" as an image caption). Salvaged from #13913 by @ypwcharles — the gateway busy-session/queue infrastructure was rewritten since that PR (Telegram moved to plugins/platforms/, /queue now uses the FIFO chain), so the media fix is reimplemented against the current handler; the PR's batching and busy-bypass changes targeted code paths that no longer exist. Co-authored-by: ypwcharles <92324143+ypwcharles@users.noreply.github.com>
Collaborator
Related: salvage of #13913 (@ypwcharles), reimplemented against the current FIFO /queue handler; same media-preservation class as #19825 (interrupt path). Flagging the cluster for a maintainer pick. |
19 tasks
19 tasks
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
/queueno longer drops the media and reply context attached to the command — the deferred turn now runs with the full payload intact.Root cause: the running-agent
/queuehandler rebuilt the queuedMessageEventwith onlytext/message_type/source/message_id/channel_prompt, silently discardingmedia_urls,media_types,raw_message, and allreply_to_*fields. When the queued turn drained, the attachment was already gone.Changes
gateway/run.py: carrymedia_urls,media_types,raw_message,reply_to_*,auto_skill,internal,timestampthrough to the queued event; setmessage_typefrom the source event when it has media; accept a media-only/queue(no prompt text required when an attachment is present, e.g./queueas an image caption).tests/gateway/test_queue_command.py: new — 5 tests driving the real_handle_messagerunning-agent path (text-only, photo media, media-without-text, reply context, empty-usage guard).scripts/release.py: AUTHOR_MAP entry for the co-author.Validation
/queue look at this+ photomedia_urls/media_typespreserved/queue+ document, no textUsage: /queue <prompt>/queue and thisas a replyreply_to_*losttests/gateway/test_queue_command.pytests/gateway/test_queue_consumption.pySalvaged from #13913 by @ypwcharles. The gateway busy-session/queue subsystem was rewritten since that April PR — Telegram moved to
plugins/platforms/,/queuenow uses the FIFO chain — so the media fix is reimplemented against the current handler. The PR's command-batching and_busy_session_bypasschanges targeted code paths that no longer exist and were dropped.Infographic