Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

tui: pasting a PDF path auto-attaches it, which text-only models cannot read

Abierto Apto para principiantes
#57,698 3 comentarios 0 reacciones 0 asignados Ver en GitHub

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
Área
cli, frontend

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

  1. Copy the absolute path of an existing PDF (e.g. /home/user/Downloads/paper.pdf).
  2. Paste it into the prompt.
  3. The prompt inserts a [PDF 1] attachment instead of the path text.
  4. Send the message with a model that does not accept PDF input.
  5. 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() computes pastedFilepath(text), calls readLocalAttachment(filepath), and for attachment.type === "binary" calls pasteAttachment().
  • pasteAttachment() labels PDFs as [PDF n] and images as [Image n].

Possible fixes (either):

  1. 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
}
  1. 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

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de anomalyco/opencode

Todos los issues de anomalyco/opencode

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.