fix(session): omit unsupported pdf tool-result attachments#21917
fix(session): omit unsupported pdf tool-result attachments#2191750sotero wants to merge 7 commits intoanomalyco:devfrom
Conversation
|
The following comment was made by an LLM, it may be inaccurate: The search results show PR #21917 (the current PR) is the only exact match. However, there are two potentially related PRs that address similar capability mismatch issues:
These PRs address similar architectural concerns about filtering attachments based on model capabilities, though they don't appear to be duplicates of the current PR (which is specifically about omitting PDF attachments when |
30f804e to
c25375a
Compare
5dd75d3 to
f34cf5c
Compare
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.
This PR also makes the Windows e2e shortcut assertion deterministic by explicitly blurring the prompt before testing
Ctrl+L, because the prior test depended on a blur side effect that is not reliable on Windows CI.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.tspackages/app/e2e/commands/input-focus.spec.tsScreenshots / recordings
Not a UI change.
Checklist