Skip to content

fix(gateway): route /background result media by type#37613

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-b92932a2
Jun 2, 2026
Merged

fix(gateway): route /background result media by type#37613
teknium1 merged 1 commit into
mainfrom
hermes/hermes-b92932a2

Conversation

@teknium1

@teknium1 teknium1 commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

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 through send_document.

The tuple-unpacking and the non-existent send_file crash 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 to send_document (streaming and kanban already route by type).

Changes

  • gateway/run.py_run_background_task: route each result media file by extension (audio→send_voice via should_send_media_as_audio, video→send_video, image→send_image_file, else send_document), honoring the per-file is_voice flag and the Telegram OGG/MP3 nuance.
  • tests/gateway/test_background_command.py — add test_media_files_routed_by_type verifying .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.py pass (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

Route background media by type

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>
@alt-glitch alt-glitch added type/bug Something isn't working comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists labels Jun 2, 2026
@teknium1 teknium1 merged commit 082025a into main Jun 2, 2026
23 checks passed
@teknium1 teknium1 deleted the hermes/hermes-b92932a2 branch June 2, 2026 23:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants