fix(gateway): route /background result media by type#37613
Merged
Conversation
Background-task (/background, /btw) result media now routes to the type-specific sender — TTS clip → voice bubble, video → send_video, image → send_image_file — instead of forcing everything through send_document. Mirrors the streaming + kanban delivery paths and reuses base.should_send_media_as_audio for the Telegram OGG nuance. Co-authored-by: LJ Li <liliangjya@gmail.com> Co-authored-by: Kolektori <256073454+Kolektori@users.noreply.github.com>
This was referenced Jun 2, 2026
This was referenced Jun 3, 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.
Summary
/background(and/btw) result media now arrives as the right kind of attachment — a TTS clip as a voice bubble, a video as a video, an image as a native image — instead of always being forced throughsend_document.The tuple-unpacking and the non-existent
send_filecrash that the original PRs targeted were both fixed independently on main since they were filed; the surviving gap was type routing in_run_background_task, which was the last delivery path still flattening everything tosend_document(streaming and kanban already route by type).Changes
gateway/run.py—_run_background_task: route each result media file by extension (audio→send_voiceviashould_send_media_as_audio, video→send_video, image→send_image_file, elsesend_document), honoring the per-fileis_voiceflag and the Telegram OGG/MP3 nuance.tests/gateway/test_background_command.py— addtest_media_files_routed_by_typeverifying.ogg→voice,.mp4→video,.png→image,.pdf→document.scripts/release.py— AUTHOR_MAP entry for co-author attribution.Validation
22/22
tests/gateway/test_background_command.pypass (21 existing + 1 new).Salvages #12091 (@truenorth-lj) and its duplicate #6225 (@Kolektori) — both reimplemented on current main since the 6-week-stale branches no longer cherry-pick cleanly; both credited via Co-authored-by trailers.
Infographic