attachments: inline PDF chip cannot be opened after send

Aperta
#310 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
android, kotlin
Ambito
mobile

Direzione di ricerca

Start in feature/session/src/main/kotlin/ai/opencode/feature/session/SessionFeatureAttachments.kt (lines 58-81) and ComposerAttachmentsFeature.kt (lines 170-176), where the staged PDF bytes are read and then discarded. Trace how SessionFeatureOutbox.kt (244-257) and server/.../Payloads.kt (488-513) drop the source, then check UserAttachmentViews.kt (103-130) for the opener. The fix must keep a readable source for the sent attachment and needs a regression test in FileAttachmentTests.kt (265-292) that opens an inline PDF after send.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

For an inline PDF attachment, Android reads the staged bytes and immediately deletes the staged file. The sent transcript row keeps neither those PDF bytes nor a server path. Unless the server returns a media:<hash> reference, the PDF chip has no opener and cannot be read after sending.

Environment

  • Android app: reporter's build not provided; behavior confirmed in v0.8.8 (c2311a60337e2a2128baba7c6eccb61b22bdb3f7) and dev (cab26e54c453fbaf8683ec456e628539d64b325f) source.
  • OpenCode server: version not provided; affects inline PDF responses without mediaHash.
  • 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.
  3. Send a prompt containing the PDF.
  4. Tap the PDF chip in the sent message.

Expected Behavior

The attachment opens in the PDF viewer, and the user can read or save the same PDF that was sent.

Actual Behavior

The chip is display-only and does not respond to taps. There is no click or drag action because the transcript file has no path or mediaViewerReference.

Additional Context

  • Inline handling is selected in feature/session/src/main/kotlin/ai/opencode/feature/session/SessionFeatureAttachments.kt:58-81.
  • ComposerAttachmentsFeature.kt:170-176 reads the bytes into memory, emits AttachmentAdded, then discards the staged copy.
  • Optimistic transcript projection drops the bytes (SessionFeatureOutbox.kt:244-257). Server decoding keeps text only for plain text and records no PDF path (server/src/main/kotlin/ai/opencode/server/live/Payloads.kt:488-513).
  • UserAttachmentViews.kt:103-130 creates an opener only from file.path or file.mediaViewerReference; otherwise the chip is inert.
  • PDF rendering already exists in feature/media/src/main/kotlin/ai/opencode/feature/media/agentfiles/AgentFileViewerModel.kt:353-359; the missing piece is a readable source reference.
  • FileAttachmentTests.kt:265-292 covers inline sending but not opening the sent PDF chip.
  • Suggested fix: retain a local or server-readable source for the lifetime of the sent attachment, then add a transcript regression test that opens an inline PDF after send.
  • Static source reproduction only; no device screenshot or log was provided.
Lingua principale
Kotlin
Stelle
146
Fork
35
Merge medio
7h 41m
PR unite (30g)
221

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di anomalyco/opencode-android

Tutte le issue di anomalyco/opencode-android

Issue simili

Altre issue su Kotlin

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.