Description
A valid PDF can be attached by read.ts, then forwarded back into model context from MessageV2.toModelMessagesEffect() even when the selected model does not support input.pdf. In the failing session, that led to a bogus The file you uploaded is badly formatted or corrupted verdict on a healthy PDF.
Important context: this session was running with the Oh My OpenAgent plugin enabled. The repeated OH-MY-OPENCODE - TODO CONTINUATION / continuation-style spam should therefore be treated as plugin-influenced behavior, not as a pure OpenCode core symptom by itself. The core issue I am reporting here is the incorrect PDF handling path, not the plugin-layer session spam.
The same file later read successfully and hashes as a healthy PDF:
- path:
debug/cv-print-test.pdf
- header:
%PDF-1.4
- sha256:
5ba26ba22bca394c29ab50d8ac1ba4097332a1100d76d9b1e2aae4195cc6216b
Current upstream packages/opencode/src/tool/read.ts does not parse PDFs into text; it returns PDF read successfully plus a PDF attachment. The risky step is later, when packages/opencode/src/session/message-v2.ts forwards completed tool-result attachments without checking model.capabilities.input.pdf.
Plugins
Oh My OpenAgent plugin enabled
OpenCode version
dev branch (observed against local clone bf601628db3c187478ff853fe33b91cec652355e)
Steps to reproduce
- Start a session with a model that does not support PDF input.
- Run the
read tool on a valid PDF so the tool result contains PDF read successfully plus a PDF attachment.
- Let the session continue so
MessageV2.toModelMessagesEffect() rebuilds model messages from the stored tool result.
- Observe that the PDF attachment can be forwarded back into model context even though the model does not support
input.pdf.
- In the failing plugin-augmented session I inspected (
ses_28910d89cffepa6F6x95rQ8dmb), that produced: The file you uploaded is badly formatted or corrupted. Please fix the file and try again.
Screenshot and/or share link
No share link. Relevant failing session: ses_28910d89cffepa6F6x95rQ8dmb
Operating System
WSL / Linux
Terminal
Shell session via OpenCode tooling
Description
A valid PDF can be attached by
read.ts, then forwarded back into model context fromMessageV2.toModelMessagesEffect()even when the selected model does not supportinput.pdf. In the failing session, that led to a bogusThe file you uploaded is badly formatted or corruptedverdict on a healthy PDF.Important context: this session was running with the Oh My OpenAgent plugin enabled. The repeated
OH-MY-OPENCODE - TODO CONTINUATION/ continuation-style spam should therefore be treated as plugin-influenced behavior, not as a pure OpenCode core symptom by itself. The core issue I am reporting here is the incorrect PDF handling path, not the plugin-layer session spam.The same file later read successfully and hashes as a healthy PDF:
debug/cv-print-test.pdf%PDF-1.45ba26ba22bca394c29ab50d8ac1ba4097332a1100d76d9b1e2aae4195cc6216bCurrent upstream
packages/opencode/src/tool/read.tsdoes not parse PDFs into text; it returnsPDF read successfullyplus a PDF attachment. The risky step is later, whenpackages/opencode/src/session/message-v2.tsforwards completed tool-result attachments without checkingmodel.capabilities.input.pdf.Plugins
Oh My OpenAgent plugin enabled
OpenCode version
devbranch (observed against local clonebf601628db3c187478ff853fe33b91cec652355e)Steps to reproduce
readtool on a valid PDF so the tool result containsPDF read successfullyplus a PDF attachment.MessageV2.toModelMessagesEffect()rebuilds model messages from the stored tool result.input.pdf.ses_28910d89cffepa6F6x95rQ8dmb), that produced:The file you uploaded is badly formatted or corrupted. Please fix the file and try again.Screenshot and/or share link
No share link. Relevant failing session:
ses_28910d89cffepa6F6x95rQ8dmbOperating System
WSL / Linux
Terminal
Shell session via OpenCode tooling