-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Description
Summary
When reloading an ACP session, file attachments are not replayed correctly, causing missing files, lost filenames, and incorrect rendering of text/binary content.
Problem
During session replay:
- File parts in stored messages aren’t replayed to ACP clients.
- Images lose their original filenames (always shown as “image”).
- Binary files (PDFs, etc.) aren’t replayed.
- Text files appear as inline text instead of attachments.
- Synthetic text parts (LLM context) are incorrectly sent to ACP clients.
Expected
Attachments should be replayed with preserved filenames and correct ACP content block types, and synthetic text should be filtered out.
Actual
Attachments are missing or mis-typed, filenames are lost, and synthetic text is replayed.
Steps to Reproduce
- Start an ACP session and attach:
- an image (e.g.,
photo.png), - a PDF (e.g.,
doc.pdf), - a text file (e.g.,
notes.txt).
- an image (e.g.,
- End the session.
- Reload the ACP session.
- Observe replayed content in the ACP client.
Proposed Solution
Update processMessage() in packages/opencode/src/acp/agent.ts to handle file parts during session replay:
file://URLs → replay asresource_linkimage/*→ replay asimageblocks, preserving original filenametext/*andapplication/json→ replay asresourcewith decodedtext- binary files → replay as
resourcewithblob
Also update prompt() to:
- Preserve filenames from
resource_link.nameandimage.uri - Handle
resource.blobby storing file parts with data URLs - Check
resource.texttruthiness (not just property existence) - Filter
!part.syntheticwhen replaying text
Changes Outline
- Add file part handling in
processMessage()for replay - Filter synthetic text parts (
!part.synthetic) - Preserve filename from
resource_link.namein prompt conversion - Handle binary
resource.blobinprompt()
Plugins
No response
OpenCode version
No response
Steps to reproduce
- Start an ACP session and attach:
- an image (e.g., photo.png),
- a PDF (e.g., doc.pdf),
- a text file (e.g., notes.txt).
- End the session.
- Reload the ACP session.
- Observe replayed content in the ACP client.
Screenshot and/or share link
No response
Operating System
No response
Terminal
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working