{{ message }}
fix(session): omit unsupported pdf tool-result attachments#21909
Closed
50sotero wants to merge 2 commits into
Closed
fix(session): omit unsupported pdf tool-result attachments#2190950sotero wants to merge 2 commits into
50sotero wants to merge 2 commits into
Conversation
Contributor
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Issue for this PR
Closes #21908
Type of change
What does this PR do?
This PR stops completed tool results from forwarding PDF attachments back into model context when the selected model does not support
input.pdf.read.tscurrently treats PDFs as attachments and returnsPDF read successfully, which is fine. The problem is later inMessageV2.toModelMessagesEffect(): completed tool-result attachments are passed through for OpenAI-compatible SDKs without checking whether the actual model can accept PDFs. That means a healthy PDF can be reintroduced into model context for a model that cannot consume PDFs, and the downstream provider/model can respond as if the file were malformed.Important context: the investigated session used the Oh My OpenAgent plugin. The repeated continuation / todo spam observed in that session should be treated as plugin-influenced behavior, not as the primary OpenCode-core bug this PR is fixing. This PR is intentionally limited to the PDF capability mismatch in core message assembly.
The change is intentionally narrow:
application/pdftool-result attachments whenmodel.capabilities.input.pdfis falsereadtool-result caseHow did you verify your code works?
%PDF-1.4, SHA-2565ba26ba22bca394c29ab50d8ac1ba4097332a1100d76d9b1e2aae4195cc6216b)tool/read.tsintosession/message-v2.tspackages/opencode/test/session/message-v2.test.tsScreenshots / recordings
Not a UI change.
Checklist