Skip to content

Generated images under cache/images may not deliver via Telegram MEDIA, while image_cache works #31733

@dandomin

Description

@dandomin

Bug Description

Generated images are saved under the newer Hermes cache path (~/.hermes/cache/images/...), but Telegram media delivery from a final gateway response did not deliver the image. Copying the exact same generated image into the legacy path (~/.hermes/image_cache/...) and sending it via MEDIA: worked immediately.

This looks like a cache-root mismatch/regression around image generation output paths vs the gateway media delivery pipeline/allowlist.

Observed Behavior

In a Telegram group chat, image_generate returned a local file path like:

/Users/hermes/.hermes/cache/images/openai_codex_gpt-image-2-medium_20260524_165209_f2f01ae4.png

The assistant final response included:

MEDIA:/Users/hermes/.hermes/cache/images/openai_codex_gpt-image-2-medium_20260524_165209_f2f01ae4.png

The user did not receive the image.

As a workaround, the same file was copied to the legacy cache root:

/Users/hermes/.hermes/image_cache/system-ops-hermes-avatar.png

Then sending:

MEDIA:/Users/hermes/.hermes/image_cache/system-ops-hermes-avatar.png

worked in the same Telegram chat.

Expected Behavior

Images generated by image_generate should be saved to, or normalized into, a gateway-deliverable media cache path. A MEDIA: tag pointing at a generated image should upload the image natively to Telegram without the agent needing to know which cache directory is currently deliverable.

Actual Behavior

image_generate produced a file under ~/.hermes/cache/images, but the Telegram user did not receive it when emitted in the final response. The legacy ~/.hermes/image_cache path did deliver.

Steps to Reproduce

  1. In a Telegram gateway session, call image_generate.
  2. Let the tool return a local path under ~/.hermes/cache/images/....
  3. Include that path in the final response as MEDIA:/absolute/path/to/generated.png.
  4. Observe that the image is not delivered to the user.
  5. Copy the file into ~/.hermes/image_cache/....
  6. Send the copied path via MEDIA:/absolute/path/to/copied.png.
  7. Observe that Telegram delivery succeeds.

Environment

  • Platform: Telegram group chat
  • Host OS: macOS
  • Hermes home: /Users/hermes/.hermes
  • Generated file path: ~/.hermes/cache/images/...
  • Working file path: ~/.hermes/image_cache/...
  • Provider/model for image generation in this instance: openai-codex / gpt-image-2-medium

Related Issues

This issue is more specific: the image is already a local file, but the generated local cache path (cache/images) does not behave like the legacy deliverable path (image_cache) for Telegram delivery from the final response.

Possible Fix Direction

Unify generated media output with the gateway's validated/deliverable media roots. Options:

  1. Have image_generate write/copy generated images into the same deliverable cache root used by Telegram (image_cache or the canonical equivalent).
  2. Normalize ~/.hermes/cache/images to a deliverable root during gateway MEDIA: extraction/validation.
  3. Add a regression test that a generated image path under the current image-generation cache can be delivered through the Telegram media pipeline, not only the legacy image_cache path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existscomp/gatewayGateway runner, session dispatch, deliveryplatform/telegramTelegram bot adaptertool/visionVision analysis and image generationtype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions