Skip to content

fix(gateway): preserve media + reply payload when /queue defers a turn - #55960

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-2df0272a
Jul 1, 2026
Merged

fix(gateway): preserve media + reply payload when /queue defers a turn#55960
teknium1 merged 1 commit into
mainfrom
hermes/hermes-2df0272a

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

/queue no 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 /queue handler rebuilt the queued MessageEvent with only text/message_type/source/message_id/channel_prompt, silently discarding media_urls, media_types, raw_message, and all reply_to_* fields. When the queued turn drained, the attachment was already gone.

Changes

  • gateway/run.py: carry media_urls, media_types, raw_message, reply_to_*, auto_skill, internal, timestamp through to the queued event; set message_type from the source event when it has media; accept a media-only /queue (no prompt text required when an attachment is present, e.g. /queue as an image caption).
  • tests/gateway/test_queue_command.py: new — 5 tests driving the real _handle_message running-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

Before After
/queue look at this + photo media dropped, turn runs text-only photo media_urls/media_types preserved
/queue + document, no text rejected Usage: /queue <prompt> queued with document intact
/queue and this as a reply reply_to_* lost reply context preserved
tests/gateway/test_queue_command.py 5 passed
tests/gateway/test_queue_consumption.py 14 passed 14 passed (no regression)

Salvaged from #13913 by @ypwcharles. The gateway busy-session/queue subsystem was rewritten since that April 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 command-batching and _busy_session_bypass changes targeted code paths that no longer exist and were dropped.

Infographic

/queue payload preservation

/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>
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages labels Jul 1, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

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.

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 sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants