fix(gateway): queue voice/audio messages instead of interrupting with empty text - #8434
fix(gateway): queue voice/audio messages instead of interrupting with empty text#8434chaizijun1 wants to merge 1 commit into
Conversation
… empty text When a voice or audio message arrives while an agent is already running, the gateway calls `running_agent.interrupt(event.text)`. However, `event.text` is empty at this point because STT transcription only happens later inside `_handle_message_with_agent`. The empty-text interrupt causes the agent to hang waiting for model response. Photos already have dedicated queueing logic that avoids this problem. Apply the same pattern to voice/audio messages: queue them via `merge_pending_message_event` so they are processed with full STT transcription after the current agent turn completes. Reproducer: 1. Send a voice message to the Telegram bot 2. Before the agent finishes responding, send a second voice message 3. The agent hangs indefinitely Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Hi team, gentle bump on this one. This is a bug fix for voice/audio messages causing agent hangs when sent in quick succession. The fix mirrors the existing photo queueing pattern. Happy to adjust anything if needed! |
|
Thanks for this, and for the clear reproducer — the empty- It's since been fixed on main by a more complete mechanism (commit d55304c, "fix(gateway): transcribe voice messages during active agent runs"). Rather than forcing voice/audio into queue-only, main now transcribes the pending voice/audio event before signaling the running agent — both on the interrupt path (gateway/run.py ~L17311) and the post-run dequeue path (~L17712) — so the interrupt carries the real transcript plus the 🎙️ echo back to the user. That keeps voice messages able to interrupt (same UX as text), which this PR's queue-only approach would have removed. Closing as superseded — your diagnosis was correct, the maintainer fix just preserves the interrupt behavior. Appreciate the contribution! |
Summary
event.text— but voice messages haven't been through STT transcription yet, soevent.textis empty. This causes the agent to hang.merge_pending_message_eventpattern toMessageType.VOICEandMessageType.AUDIO.Reproducer
Changes
gateway/run.py: Add voice/audio check between the existing photo queueing block and the_AGENT_PENDING_SENTINELcheck (+12 lines)Test plan
🤖 Generated with Claude Code