tui: pasting a PDF path auto-attaches it, which text-only models cannot read
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 75/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- typescript
Línea de trabajo
Empieza en packages/tui/src/component/prompt/index.tsx, donde pasteInputText() comprueba las rutas pegadas y pasteAttachment() etiqueta los archivos adjuntos. Sigue cómo se gestionan los archivos adjuntos binarios y revisa las pruebas existentes del prompt sobre el comportamiento al pegar. El trabajo estará terminado cuando pegar la ruta de un PDF ya no haga que falle una solicitud a un modelo solo de texto y se cumpla el comportamiento esperado del issue.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
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.
Additional Context
Relevant code: packages/tui/src/component/prompt/index.tsx
pasteInputText()computespastedFilepath(text), callsreadLocalAttachment(filepath), and forattachment.type === "binary"callspasteAttachment().pasteAttachment()labels PDFs as[PDF n]and images as[Image n].
Possible fixes (either):
- Only auto-attach images; insert everything else as text:
if (attachment?.type === "binary") {
if (!attachment.mime.startsWith("image/")) {
input.insertText(normalizedText)
return
}
await pasteAttachment({ filename, filepath, mime: attachment.mime, content: ... })
return
}
- Add a CLI setting (e.g. in
~/.config/opencode/cli.json), such as:
{ "prompt": { "paste_attach": "images" } }
with values images | all | never.
The second keeps the current behavior available for users who do want document attachments.
- Lenguaje dominante
- TypeScript
- Estrellas
- 215k
- Forks
- 28.9k
- Merge medio
- 8 h 11 min
- PR fusionados (30 d)
- 365
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de anomalyco/opencode
-
reproduced
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
anomalyco/opencode#57711 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
pending close triaging
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
anomalyco/opencode#57664 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
anomalyco/opencode#57579 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
anomalyco/opencode#57536 · 1 comentario · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
fs: /cd and file pickers fail on FreeBSD/ZFS — `stat` throws "dev exceeds the safe integer range" (fixed in @effect/platform-node-shared 4.0.5)Posiblemente ocupada @argszero la tomó hace 1 día. Abiertoreproduced
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
anomalyco/opencode#57518 · 3 comentarios · 1 reacción ·
Los mantenedores suelen responder en 1 día
Todos los issues de anomalyco/opencode
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
chaitin/MonkeyCode#1437 ·
Los mantenedores suelen responder en 1 día
-
rtdb-info-connected-order test: unhandled 'connection is closed' rejection fails the CLI suiteAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 69/100
carbon-design-system/carbon-ai-chat#2615 ·
Los mantenedores suelen responder en 1 día
-
e2e-failure ready-to-code
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
redhat-developer/rhdh-plugin-export-overlays#4486 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[Bug]: fileUploadMatrix.test.ts URL case does a real DNS lookup and fails offlinePosiblemente ocupada @r2jaff la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
ComposioHQ/composio#5054 ·
Los mantenedores suelen responder en 1 día