Skip to content

[Bug] tool-result image attachments are re-fed to text-only models #43388

Closed as not planned

Description

@weike-zhang

Expected Behavior\nTool-result image attachments should not be sent back to models that do not support image input. The image should be downgraded to a safe text placeholder or otherwise stripped so the session can continue.\n\n## Current Behavior\nWhen a tool returns an image attachment, text-only models can receive a file/media part and fail with errors like: .\n\n## Steps to Reproduce\n1. Use a tool that returns an image attachment (for example an image generation tool).\n2. Run the session with a model whose is false.\n3. The image attachment is projected back into the model input and the run fails.\n\n## Root Cause\n decides whether tool-result media can be forwarded using provider-specific heuristics instead of the model capability flags. The current path can preserve media for models that are text-only, which makes the downstream model input invalid.\n\n## Suggested Fix\nGate tool-result media forwarding on / , and downgrade unsupported media to a text placeholder instead of a file attachment.\n\n## Verification\n- Added a regression test covering unsupported image tool-result media for a text-only model.\n- Added a regression test covering unsupported PDF tool-result media.\n- Existing Bedrock PDF case still preserves PDF media for a PDF-capable model.\n\n## Notes\nThe repo currently reports the session error as a model input failure, but the underlying bug is in opencode's media projection path, not the user tool itself.

Activity

  1. github-actions commented on Aug 19, 2026

    @github-actions
    Contributor

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

    Please review those issues and consider adding context there rather than opening a new report.

  2. github-actions commented on Oct 19, 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