fix(gateway): deliver MEDIA: files after streaming responses#2382
Merged
fix(gateway): deliver MEDIA: files after streaming responses#2382
Conversation
When streaming is enabled, text chunks are sent to the user in real-time including raw MEDIA: tags. The normal post-processing in _process_message_background is skipped when already_sent=True, so MEDIA: files were never extracted or delivered — the user just saw the raw MEDIA:/path/to/file text. Fix: after streaming completes, extract MEDIA: tags and local file paths from the response and deliver them via the platform adapter. The text is already sent (with the raw tag visible in the stream), but the actual files now get delivered as attachments.
teknium1
added a commit
that referenced
this pull request
Mar 22, 2026
Two fixes: 1. CLI /stop command crashed with 'cannot import name get_registry' — the code imported a non-existent function. Fixed to use the actual process_registry singleton and list_sessions() method. (Reported in #2458 by haiyuzhong1980) 2. Streaming media delivery used undefined 'adapter' variable — our PR #2382 called _deliver_media_from_response(adapter=adapter) but 'adapter' wasn't guaranteed to be defined in that scope. Fixed to resolve via self.adapters.get(source.platform). (Reported in #2424 by 42-evey)
This was referenced Mar 22, 2026
outsourc-e
pushed a commit
to outsourc-e/hermes-agent
that referenced
this pull request
Mar 26, 2026
Two fixes: 1. CLI /stop command crashed with 'cannot import name get_registry' — the code imported a non-existent function. Fixed to use the actual process_registry singleton and list_sessions() method. (Reported in NousResearch#2458 by haiyuzhong1980) 2. Streaming media delivery used undefined 'adapter' variable — our PR NousResearch#2382 called _deliver_media_from_response(adapter=adapter) but 'adapter' wasn't guaranteed to be defined in that scope. Fixed to resolve via self.adapters.get(source.platform). (Reported in NousResearch#2424 by 42-evey)
aashizpoudel
pushed a commit
to aashizpoudel/hermes-agent
that referenced
this pull request
Mar 30, 2026
Two fixes: 1. CLI /stop command crashed with 'cannot import name get_registry' — the code imported a non-existent function. Fixed to use the actual process_registry singleton and list_sessions() method. (Reported in NousResearch#2458 by haiyuzhong1980) 2. Streaming media delivery used undefined 'adapter' variable — our PR NousResearch#2382 called _deliver_media_from_response(adapter=adapter) but 'adapter' wasn't guaranteed to be defined in that scope. Fixed to resolve via self.adapters.get(source.platform). (Reported in NousResearch#2424 by 42-evey)
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.
When streaming is enabled, text chunks go directly to the user including raw
MEDIA:/path/to/filetags. The normal post-processing in_process_message_backgroundis skipped whenalready_sent=True, so MEDIA: files were never extracted or delivered.Users on Telegram (and other platforms) with streaming enabled saw literal
MEDIA:/home/user/.hermes/...text but never received the actual file attachment.Fix: After streaming completes, call
_deliver_media_from_response()to extract MEDIA: tags and local file paths, then deliver them via the platform adapter's native send methods (send_document, send_image_file, send_video, send_voice).The raw MEDIA: tag text still appears in the streamed output (can't un-send already-streamed chunks), but the actual files now get delivered as separate attachments afterward.
1286 gateway tests pass.