fix(gateway): preserve full MessageEvent in active interrupt path - #19825
Closed
QuenVix wants to merge 1 commit into
Closed
fix(gateway): preserve full MessageEvent in active interrupt path#19825QuenVix wants to merge 1 commit into
QuenVix wants to merge 1 commit into
Conversation
Contributor
|
Thanks for the focused gateway reliability report and regression test. Automated hermes-sweeper review found this is already implemented on current
The existing |
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
This fixes a gateway reliability bug in the active-session interrupt path.
When a user sent a follow-up message during an active run, the priority interrupt branch in
GatewayRunner._handle_message()stored onlyevent.textin the runner-local pending queue. That worked for plain text, but it dropped the fullMessageEventfor media follow-ups such as voice, audio, or documents.As a result, caption-less or media-only follow-ups could lose their attachment metadata before the next-turn drain, so the queued follow-up no longer re-entered the normal media/STT/document preprocessing path.
What changed
MessageEventintoadapter._pending_messagesin the priority interrupt path.Why this is correct
The gateway already treats adapter-level pending queues as the canonical next-turn handoff for rich follow-ups. Other paths already preserve full events there; this patch aligns the priority interrupt branch with the same behavior instead of collapsing the follow-up into plain text.
That means media follow-ups now survive the interrupt boundary with their original metadata intact.
Tests
Added a regression test covering an active-session interrupt with a media-only voice follow-up:
test_handle_message_interrupt_mode_preserves_voice_followup_eventVerified with:
pytest tests/gateway/test_busy_session_ack.py -qpytest tests/gateway/test_queue_consumption.py -qRisk
Low. This is a narrow change in one gateway branch and keeps the legacy text-only path only for the no-adapter fallback case.