Skip to content

fix(opencode): fix the read tool reports image/pdf read successfully when the LLM lacks vision capabilities#22263

Open
Demonese wants to merge 3 commits intoanomalyco:devfrom
Demonese:fix/read-tool-vision
Open

fix(opencode): fix the read tool reports image/pdf read successfully when the LLM lacks vision capabilities#22263
Demonese wants to merge 3 commits intoanomalyco:devfrom
Demonese:fix/read-tool-vision

Conversation

@Demonese
Copy link
Copy Markdown

@Demonese Demonese commented Apr 13, 2026

Issue for this PR

Closes #21800

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The description of the read tool can mislead text-only LLMs, causing them to hallucinate that they can understand image content.

To fix this issue, I first inspected the source code of the read tool and found that it does not verify the LLM vision capabilities when handling images and PDF files.

So fixed it.

How did you verify your code works?

See Screenshots / recordings

Screenshots / recordings

image

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions bot added needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels Apr 13, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions github-actions bot removed needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels Apr 13, 2026
@github-actions
Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on my search, I found one potentially related PR that should be reviewed:

Related PR:

The other results (#21917, #11333, #15262) are related to PDF/image handling but appear to be older or more specific fixes that may not directly conflict with the current PR.

@github-actions
Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

…when the LLM lacks vision capabilities (Effect.fail)
…when the LLM lacks vision capabilities (update error message)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The description of the read tool can mislead text-only LLMs, causing them to hallucinate that they can understand image content.

1 participant