Skip to content

Text-only models still receive image read attachments in prompt context #17205

Closed as not planned

Description

@Harryoung

Summary

When a text-only model such as zai-coding-plan/glm-4.7 uses the Read tool on an image, the tool still emits a data:image/...;base64,... attachment. That attachment can move through the message-building path before the provider layer finally rejects image input.

Problem

This is the wrong place to catch the error. By the time the provider rejects the image, the image payload has already entered prompt construction and can cause unnecessary context growth or overflow.

Expected behavior

If the current model does not support image or PDF input, the file should not be attached to the conversation at all. The tool or message layer should emit a short text explanation instead.

Notes

A complete fix should guard both the Read tool path and the message conversion path for tool-result media so unsupported media cannot be reintroduced later by another tool.

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 12, 2026
  2. github-actions commented on Mar 12, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

  3. tobwen commented on Mar 13, 2026

    @tobwen
    Contributor

    Can this behaviour be enabled/disabled in the config? I wouldn't want huge images to be sent to the LLM (input tokens).

  4. Harryoung commented on Mar 16, 2026

    @Harryoung
    Author

    Can this behaviour be enabled/disabled in the config? I wouldn't want huge images to be sent to the LLM (input tokens).

    Agree. Even for models that support multimodal input, it’s not always desirable to push the entire image or PDF into the input context. Large files can easily bloat the prompt and consume tokens without necessarily adding useful signal.

  5. added 8 commits that reference this issue on Apr 25, 2026
  6. removed
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  7. github-actions commented on Jul 3, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions