Skip to content

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

@Harryoung

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.

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)

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