You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The V2 read tool cannot read PDF files. ReadToolFileSystem.read sniffs magic bytes with imageMime(first) only (packages/core/src/tool/read-filesystem.ts:188); a PDF sniffs as non-image, contains null bytes, and fails with BinaryFileError ("Cannot read binary file").
This is a regression from V1, whose read tool returned PDFs as model attachments (packages/opencode/src/tool/read.ts:306 — "PDF read successfully" with a data:application/pdf;base64,... attachment).
V2 is not PDF-blind elsewhere:
Prompt attachments accept any mime, so users can attach PDFs via SessionV2.prompt.
Provider lowering already handles application/pdf file parts (e.g. packages/core/src/github-copilot/responses/convert-to-openai-responses-input.ts:104).
The gap is specifically that the agent cannot pull a PDF off disk with the read tool.
Considerations for the fix
Reuse the existing 20 MiB MAX_MEDIA_INGEST_BYTES cap for PDF ingest, matching image reads and MAX_ATTACHMENT_BYTES.
Tool settlement currently bounds only image content (ToolRegistry image normalization, feat(core): normalize tool and attachment images at settlement #37141). PDFs have no resize equivalent, so unbounded inline PDF base64 persisted in message rows and re-sent per request would reintroduce the HTTP 413 exposure class (bug(v2): inline image results make compaction fail with HTTP 413 #36552) through a new path. PDF support should land with an explicit size policy for non-image media at settlement (hard cap, drop-with-note, or managed retention) rather than inheriting no bound.
Model capability varies: only some providers accept PDF input, so the read tool may need to fail gracefully or degrade when the active model cannot consume application/pdf.
Problem
The V2
readtool cannot read PDF files.ReadToolFileSystem.readsniffs magic bytes withimageMime(first)only (packages/core/src/tool/read-filesystem.ts:188); a PDF sniffs as non-image, contains null bytes, and fails withBinaryFileError("Cannot read binary file").This is a regression from V1, whose read tool returned PDFs as model attachments (
packages/opencode/src/tool/read.ts:306— "PDF read successfully" with adata:application/pdf;base64,...attachment).V2 is not PDF-blind elsewhere:
SessionV2.prompt.application/pdffile parts (e.g.packages/core/src/github-copilot/responses/convert-to-openai-responses-input.ts:104).The gap is specifically that the agent cannot pull a PDF off disk with the read tool.
Considerations for the fix
MAX_MEDIA_INGEST_BYTEScap for PDF ingest, matching image reads andMAX_ATTACHMENT_BYTES.ToolRegistryimage normalization, feat(core): normalize tool and attachment images at settlement #37141). PDFs have no resize equivalent, so unbounded inline PDF base64 persisted in message rows and re-sent per request would reintroduce the HTTP 413 exposure class (bug(v2): inline image results make compaction fail with HTTP 413 #36552) through a new path. PDF support should land with an explicit size policy for non-image media at settlement (hard cap, drop-with-note, or managed retention) rather than inheriting no bound.application/pdf.