attachments: PDF capability is not revalidated after a model switch

Ouverte
#311 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
30/100
Type d'issue
Bug
Clarté
Plutôt claire
Activité
Active
Stack technique
android, kotlin
Domaine
mobile-dev

Piste de recherche

Start with the attach-time PDF capability check in feature/session/src/main/kotlin/ai/opencode/feature/session/SessionFeatureAttachments.kt (lines 58-81), then trace how model selection in SessionFeatureSend.kt (around 627-630) leaves pendingAttachments untouched. Follow the send snapshot in SessionFeatureSend.kt (321-323, 414-425) into SessionFeatureDelivery.kt (333-362). Done means the send path revalidates attachments against the model chosen at send time, with a readable error or fallback, covered by tests extending FileAttachmentTests.kt (265-292).

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

Summary

PDF input support is checked when the file is attached, not when the prompt is sent. If the user attaches a PDF while using a PDF-capable model and then switches to a text-only model, Android sends the same inline PDF to the new model. The provider can reject the prompt or the model can report that it cannot read the attachment.

Environment

  • Android app: reporter's build not provided; behavior confirmed in v0.8.8 (c2311a60337e2a2128baba7c6eccb61b22bdb3f7) and dev (cab26e54c453fbaf8683ec456e628539d64b325f) source.
  • OpenCode server: version not provided.
  • Device/OS: not provided.
  • Terminal/shell: not applicable.
  • Active plugins: none required.

Reproduction

  1. Select a model whose catalog entry advertises PDF input.
  2. Attach a PDF no larger than 20 MiB. Android reads it inline.
  3. Before sending, switch to a model whose catalog entry does not advertise PDF input.
  4. Send the prompt.

Expected Behavior

Android revalidates the attachment against the model selected at send time. It either uploads the PDF as a path-backed file with a clear explanation, extracts supported text, or blocks sending and explains that the selected model cannot read PDFs. The draft and attachment remain intact.

Actual Behavior

The inline PDF bytes remain in pendingAttachments. Delivery switches the server to the new model and posts the unchanged PDF file part. There is no compatibility warning or fallback, so the failure appears only after submission as a provider error or an unreadable attachment.

Additional Context

  • Attach-time capability check: feature/session/src/main/kotlin/ai/opencode/feature/session/SessionFeatureAttachments.kt:58-81.
  • Model selection changes model state but does not revisit attachments: SessionFeatureSend.kt:627-630.
  • Send snapshots the unchanged attachment list: SessionFeatureSend.kt:321-323,414-425.
  • Delivery switches the model, then posts the same inline attachments: SessionFeatureDelivery.kt:333-362.
  • FileAttachmentTests.kt:265-292 covers attaching and sending a PDF to a capable model, but not switching models between those steps.
  • Suggested acceptance checks: capable → text-only model switch, text-only → capable switch, queued sends, draft preservation, and a readable error when no fallback exists.
  • Static source reproduction only; no provider response, device screenshot, or log was provided.
Langage dominant
Kotlin
Étoiles
146
Forks
35
Merge moyen
7 h 41 min
PR mergées (30 j)
221

Préparer son environnement

Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de anomalyco/opencode-android

Toutes les issues de anomalyco/opencode-android

Issues similaires

Plus d'issues Kotlin

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.