Skip to content

fix(gateway): expose native image cache paths to tools - #20971

Closed
LeonSGP43 wants to merge 1 commit into
NousResearch:mainfrom
LeonSGP43:fix/gateway-native-image-attachment-paths
Closed

fix(gateway): expose native image cache paths to tools#20971
LeonSGP43 wants to merge 1 commit into
NousResearch:mainfrom
LeonSGP43:fix/gateway-native-image-attachment-paths

Conversation

@LeonSGP43

Copy link
Copy Markdown
Contributor

Closes #20899

Summary

  • include cached local image attachment paths in the gateway text context when native image routing is used
  • keep the native multimodal image attachment path unchanged for models that support vision
  • add a regression test proving the prepared native-image message exposes the cached path for tool use

Why

Telegram photos are already cached locally before reaching the agent, but when native image routing is selected the model receives pixels inline and the text context did not include the cached path. That leaves file/terminal tools without an obvious handle for requests like “put this image in this folder.”

Verification

  • scripts/run_tests.sh tests/gateway/test_native_image_buffer_isolation.py tests/gateway/test_telegram_documents.py tests/gateway/test_telegram_photo_interrupts.py
    • 43 passed in 1.87s
  • git diff --check

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery platform/telegram Telegram bot adapter labels May 7, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Competing PR: #20906 also fixes #20899 with a broader approach (per-chat attachment cache in base platform + Telegram-specific handling across 4 files). This PR takes a narrower approach — injecting path text into the message context only for native image routing in gateway/run.py.

Maintainers: these overlap on #20899. Consider which scope is preferred or if they can be merged.

@teknium1

Copy link
Copy Markdown
Contributor

This appears to be implemented on current main by the shared native image routing path.

Automated hermes-sweeper review evidence:

  • agent/image_routing.py:522 appends [Image attached at: <path>] into the text part for successfully attached local native images, giving the model a tool-usable path handle while preserving native image delivery.
  • gateway/run.py:14241-14248 consumes the gateway's buffered native image paths and passes them into build_native_content_parts(), so Telegram/gateway native image turns receive that same path hint.
  • tests/agent/test_image_routing.py:314 and related assertions cover the path hint behavior.
  • The implementation is present in 769ee86cd2b346f6bffedd84ca9067fde2790eeb, contained in v2026.5.29 and later tags.

This only closes the narrow overlap in this PR; the broader attachment-cache discussion in #20899 / #20906 remains a separate maintainer decision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists platform/telegram Telegram bot adapter sweeper:implemented-on-main Sweeper: behavior already present on current main type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Telegram inbound images are visible to model but not exposed as tool-accessible attachments

3 participants