fix(gateway): auto-deliver image_generate output as native media#42616
Merged
Conversation
image_generate returns its artifact as JSON ({"image": "/abs/path.png"})
with no MEDIA: tag, so the gateway auto-append path (which only recognized
text_to_speech MEDIA: tags) never delivered it — image delivery silently
depended on the model restating the path in its reply. Add image_generate to
the producer allowlist and extract the local path from its JSON result
(host_image > image > agent_visible_image), reusing the existing
extension-anchored matcher and history-dedupe so remote URLs, unknown
extensions, failures, and already-sent paths are rejected.
Closes the remaining unfixed path from #19105.
Contributor
🔎 Lint report:
|
HotGirlLo
approved these changes
Jun 9, 2026
a249169329-cpu
pushed a commit
to a249169329-cpu/hermes-agent
that referenced
this pull request
Jun 9, 2026
…sResearch#42616) image_generate returns its artifact as JSON ({"image": "/abs/path.png"}) with no MEDIA: tag, so the gateway auto-append path (which only recognized text_to_speech MEDIA: tags) never delivered it — image delivery silently depended on the model restating the path in its reply. Add image_generate to the producer allowlist and extract the local path from its JSON result (host_image > image > agent_visible_image), reusing the existing extension-anchored matcher and history-dedupe so remote URLs, unknown extensions, failures, and already-sent paths are rejected. Closes the remaining unfixed path from NousResearch#19105.
4 tasks
wachoo
pushed a commit
to wachoo/hermes-agent
that referenced
this pull request
Jun 10, 2026
…sResearch#42616) image_generate returns its artifact as JSON ({"image": "/abs/path.png"}) with no MEDIA: tag, so the gateway auto-append path (which only recognized text_to_speech MEDIA: tags) never delivered it — image delivery silently depended on the model restating the path in its reply. Add image_generate to the producer allowlist and extract the local path from its JSON result (host_image > image > agent_visible_image), reusing the existing extension-anchored matcher and history-dedupe so remote URLs, unknown extensions, failures, and already-sent paths are rejected. Closes the remaining unfixed path from NousResearch#19105.
changman
pushed a commit
to changman/hermes-agent
that referenced
this pull request
Jun 10, 2026
…sResearch#42616) image_generate returns its artifact as JSON ({"image": "/abs/path.png"}) with no MEDIA: tag, so the gateway auto-append path (which only recognized text_to_speech MEDIA: tags) never delivered it — image delivery silently depended on the model restating the path in its reply. Add image_generate to the producer allowlist and extract the local path from its JSON result (host_image > image > agent_visible_image), reusing the existing extension-anchored matcher and history-dedupe so remote URLs, unknown extensions, failures, and already-sent paths are rejected. Closes the remaining unfixed path from NousResearch#19105.
alt-glitch
pushed a commit
that referenced
this pull request
Jun 14, 2026
) image_generate returns its artifact as JSON ({"image": "/abs/path.png"}) with no MEDIA: tag, so the gateway auto-append path (which only recognized text_to_speech MEDIA: tags) never delivered it — image delivery silently depended on the model restating the path in its reply. Add image_generate to the producer allowlist and extract the local path from its JSON result (host_image > image > agent_visible_image), reusing the existing extension-anchored matcher and history-dedupe so remote URLs, unknown extensions, failures, and already-sent paths are rejected. Closes the remaining unfixed path from #19105.
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
Generated images now deliver natively on every gateway platform (WhatsApp, Telegram, Signal, …) without depending on the model restating the file path.
image_generatereturns its artifact as a JSON payload ({"success": true, "image": "/abs/path.png"}) with noMEDIA:tag. The gateway's auto-append path only recognized literalMEDIA:tags fromtext_to_speech, so image delivery silently relied on the model echoing the path into its reply. When it didn't, the image was dropped.Changes
gateway/run.py: addimage_generateto_AUTO_APPEND_MEDIA_TOOL_NAMES; the auto-append scanner now extracts the local-file path from the tool's JSON result (host_image→image→agent_visible_image, first deliverable wins) and synthesizes aMEDIA:tag. Reuses the existing extension-anchored_TOOL_MEDIA_REand history-dedupe set, so remote URLs, unknown extensions, failed generations, and already-delivered paths are all rejected.tests/gateway/test_media_extraction.py: 4 new tests — JSON path delivery, host-path preference, failure/URL rejection, history dedupe.Validation
image_generateJSON →MEDIA:/pathsuccess: false/ remote URL / unknown exttext_to_speechMEDIA: pathtests/gateway/test_media_extraction.py test_platform_base.py test_stream_consumer.py test_tts_media_routing.py→ 262 passed.Closes the one path from #19105 not already covered by the WhatsApp native-media work on
main. The other four paths in that issue (WhatsAppsend_messageMEDIA:, native image/video/audio bridge sends, inbound video paths, history dedupe) were independently implemented since the issue was filed; PR #19106 (@hedirman) was closed in favor of that work with credit.Infographic