fix(telegram): preserve busy-session queue payloads - #13913
Conversation
|
Supplemental validation note: local test runs above used the repo's declared dev pytest environment from GitHub Actions for this fork PR are currently in |
|
Related upstream context: this PR overlaps with the same busy-session slash-command problem area as #6252 and #10370 (active-session bypass / non-interrupting slash-command handling in The additional scope here is Telegram-specific:
So this is not intended as a duplicate of those PRs; it is meant to close the Telegram split/payload preservation gap in the same area. |
/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>
|
Thanks for this — the media-loss half of it was a genuine bug and your report is what surfaced it. Merged the fix via #55960 (commit Since April the gateway busy-session/queue subsystem was rewritten: Telegram moved out of Closing this in favor of #55960 — #55960 — credited to you. Appreciate the catch! |
Thanks for the fix and for keeping the co-author attribution. I’ll pull latest and verify the /queue media/media-only cases on my Telegram setup. |
/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 NousResearch#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>
/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 NousResearch#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>
/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 NousResearch#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>
/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 NousResearch#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>
/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 NousResearch#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>
/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 NousResearch#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>
/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 NousResearch#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>
Summary
/queuemedia/reply metadata when a busy session queues the next turn/queue,/background,/btw,/plan) so split follow-up chunks stay attached to the original commandWhy
Telegram can split long slash-command messages client-side. The first chunk arrives as a command update, but continuation chunks arrive as plain text. Without batching and canonical busy-session handling, queued prompts could lose media payloads or treat continuation chunks as a brand-new follow-up.
Validation run locally
Local test runs used the repo's declared dev test stack from
pyproject.toml(pytest,pytest-asyncio,pytest-xdist) via:/home/yangp/.hermes/hermes-agent/venv/bin/python3/home/yangp/.hermes/hermes-agent/venv/lib/python3.11/site-packages/pytest(9.0.3)PR-focused regression coverage
python3 -m pytest tests/gateway/test_busy_session_bypass_race.py tests/gateway/test_telegram_text_batching.py tests/gateway/test_base_topic_sessions.py -v26 passedpython3 -m pytest tests/gateway/test_session_race_guard.py tests/gateway/test_busy_session_bypass_race.py tests/gateway/test_telegram_text_batching.py tests/gateway/test_base_topic_sessions.py -q42 passedpython3 -m pytest tests/gateway/test_discord_send.py tests/gateway/test_send_image_file.py -q38 passedFull suite context
python3 -m pytest tests/ -v14074 passed, 75 failed, 35 skippedupstream/mainin the same environment and do not appear unique to this PR, including failures intests/tools/test_voice_mode.py,tests/tools/test_browser_camofox.py,tests/tools/test_write_deny.py,tests/tools/test_zombie_process_cleanup.py,tests/gateway/test_agent_cache.py,tests/run_agent/test_real_interrupt_subagent.py, and parts oftests/gateway/test_approve_deny_commands.py.Platforms tested