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
{{ message }}
Repository navigation
tui: pasting a PDF path auto-attaches it, which text-only models cannot read #57698
Pasting a path to an existing PDF into the prompt auto-attaches the file as [PDF 1]. With a text-only model (no PDF input), sending the message fails, and there is no setting to disable this auto-attachment.
Environment
opencode version: 2.0.32
OS: Linux 7.2.9-arch1-1 (Arch Linux, x86_64)
Terminal: xterm-256color
Shell: /usr/bin/zsh
Install/channel: packaged binary at /usr/bin/opencode (latest)
Active plugins: none found in config
Reproduction
Copy the absolute path of an existing PDF (e.g. /home/user/Downloads/paper.pdf).
Paste it into the prompt.
The prompt inserts a [PDF 1] attachment instead of the path text.
Send the message with a model that does not accept PDF input.
The request fails: this model does not support pdf input.
Reproducible consistently.
Expected Behavior
Pasting a document path should insert the path as text so the agent can read it with tools. Auto-attachment should be limited to images, which vision-capable models can consume — or there should be a setting to disable file-path auto-attachment.
Actual Behavior
Any pasted text that resolves to an existing binary file is attached. PDFs become [PDF n], which text-only models cannot read, so the turn fails instead of passing the path to the agent.
Thanks for the detailed report and the suggested fixes!
To restate the request: when you paste a path to a local document such as a PDF, you'd like it inserted as plain text so the agent can read the file with its tools, instead of being turned into a [PDF n] attachment. You'd also like auto-attachment limited to images, or a setting such as prompt.paste_attach: images | all | never to control it.
I checked the current code, and turning pasted image and PDF paths into attachments is intentional (packages/tui/src/component/prompt/local-attachment.ts). What's missing is a way to opt out, and any check of whether the active model accepts PDF input. So I've marked this as a feature request, and the maintainers will consider it. Note that the function names in your snippet don't quite match the current dev code (it now uses resolvePastedAttachments), so a patch would need adjusting. A plugin can't work around this today, because the plugin API has no hook into TUI paste handling.
These open issues also cover pasted paths becoming attachments:
This issue reports a capability failure: the model cannot read PDFs at all, so the turn fails with this model does not support pdf input regardless of document size.
Both stem from the same underlying behaviour — a pasted file path is auto-attached instead of inserted as text. A "paste as text" option would fix both, but the two reports document different user-facing failures and different triggers (document size vs. model capability), so neither is subsumed by the other.
Additional UX suggestion, in the same spirit as the existing pasted-text expansion:
Make an auto-attached file chip expandable back to its source path.
Today the TUI already has the pattern for long pastes: pasteText() stores the full text in the part and shows a virtual [Pasted ~N lines] placeholder (part.source.text.value), which is expanded back to the real text on submit (expandPastedTextPlaceholders in packages/tui/src/prompt/part.ts). A file attachment shows [PDF n] / [Image n] but has no way back.
pasteAttachment() already keeps filepath on the file part, so the data needed for a reversal is present. Suggested behaviour:
Clicking the [PDF 1] chip (or a keybind / context action) detaches the file and replaces the chip with the path text, so the agent can read it with its tools.
Symmetrically, this could offer "attach instead" when a path is pasted as text.
This gives an in-place recovery path for both failure modes: the context-size case in #57162 and the text-only-model case here — without needing to revert the message or re-type the path.
It would also compose with the proposed prompt.paste_attach setting: the setting decides the default, and the chip lets the user override it per paste.
Activity
opencode-agent commentedon Oct 21, 2026
Thanks for the detailed report and the suggested fixes!
To restate the request: when you paste a path to a local document such as a PDF, you'd like it inserted as plain text so the agent can read the file with its tools, instead of being turned into a
[PDF n]attachment. You'd also like auto-attachment limited to images, or a setting such asprompt.paste_attach: images | all | neverto control it.I checked the current code, and turning pasted image and PDF paths into attachments is intentional (
packages/tui/src/component/prompt/local-attachment.ts). What's missing is a way to opt out, and any check of whether the active model accepts PDF input. So I've marked this as a feature request, and the maintainers will consider it. Note that the function names in your snippet don't quite match the currentdevcode (it now usesresolvePastedAttachments), so a patch would need adjusting. A plugin can't work around this today, because the plugin API has no hook into TUI paste handling.These open issues also cover pasted paths becoming attachments:
beenotung commentedon Oct 21, 2026
Related, but not a duplicate of #57162.
this model does not support pdf inputregardless of document size.Both stem from the same underlying behaviour — a pasted file path is auto-attached instead of inserted as text. A "paste as text" option would fix both, but the two reports document different user-facing failures and different triggers (document size vs. model capability), so neither is subsumed by the other.
beenotung commentedon Oct 21, 2026
Additional UX suggestion, in the same spirit as the existing pasted-text expansion:
Make an auto-attached file chip expandable back to its source path.
Today the TUI already has the pattern for long pastes:
pasteText()stores the full text in the part and shows a virtual[Pasted ~N lines]placeholder (part.source.text.value), which is expanded back to the real text on submit (expandPastedTextPlaceholdersinpackages/tui/src/prompt/part.ts). A file attachment shows[PDF n]/[Image n]but has no way back.pasteAttachment()already keepsfilepathon the file part, so the data needed for a reversal is present. Suggested behaviour:[PDF 1]chip (or a keybind / context action) detaches the file and replaces the chip with the path text, so the agent can read it with its tools.This gives an in-place recovery path for both failure modes: the context-size case in #57162 and the text-only-model case here — without needing to revert the message or re-type the path.
It would also compose with the proposed
prompt.paste_attachsetting: the setting decides the default, and the chip lets the user override it per paste.