anomalyco / anomalyco/opencode
session: pasted/dropped images are persisted but silently stripped from the model request on v2 beta
@nexxeln is already working on this.
Since Aug 28, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
On v2 beta, images attached to a user message (Ctrl+V paste or drag-and-drop) are persisted as image/* file parts in the session store, but the model request contains only the literal text [Image 1]. The selected model declares image input in its resolved capabilities, and nothing is logged or shown — the image is silently stripped. Tool-result images (e.g. Read on a local PNG) do reach the model in the same session, which isolates the failure to the user-message → model-request path.
Suspect: the stripMedia placeholder path in packages/opencode/src/session/message-v2.ts (see #42758) firing even though the model declares image input.
Plugins
clock-hook.js,identity.js(loaded)luvus.js,rtk.tsfail to load withSchemaError: Missing key at ["default"](pre-existing, unrelated — the issue reproduces regardless)
OpenCode version
opencode2 v0.0.0-beta-18414 (npm @opencode-ai/cli, beta channel)
Steps to reproduce
- Start
opencode2, select built-in providermerge-gateway, modelzai/glm-5.3-flash. The resolved entry uses packageaisdk:merge-gateway-ai-sdk-providerwithcapabilities.inputincludingimage. - In the TUI, press Ctrl+V to paste an image into the prompt (it shows as
[Image 1]), send "describe this image". - The model replies it cannot see any image — it only received the literal text
[Image 1]. GET /api/session/{id}/message/{msgID}confirms the message persistedfiles[0]: { mime: "image/png", source: { type: "inline" }, data: <~1 MB base64> }; the server log shows no error at send time.- Repeat with a drag-dropped JPEG — same result (persisted, model sees only the placeholder).
Control: same session and model, Read tool on a local PNG → the image reaches the model and is described correctly.
Screenshot and/or share link
Not shared (session contains unrelated personal content). Evidence excerpts:
// GET /api/model (excerpt)
{ "providerID": "merge-gateway", "id": "zai/glm-5.3-flash",
"package": "aisdk:merge-gateway-ai-sdk-provider",
"capabilities": { "tools": true, "input": ["text","image","video","pdf"], "output": ["text"] } }
// GET /api/session/{id}/message/{msgID} (excerpt, base64 truncated)
{ "type": "user", "text": "[Image 1] <prompt>",
"files": [ { "data": "iVBORw0KGgo...(len 1035512)", "mime": "image/png",
"source": { "type": "inline" }, "name": "1787906587870_d.png" } ] }
Operating System
Windows 10 (10.0.19045), x64
Terminal
Windows Terminal (pwsh 7), opencode2 TUI
Related: #39083 (v1, intermittent — this is consistent on v2 beta), #42758 (covers models without vision; here the model declares vision and is still stripped), #20802 / #33542 (custom OpenAI-compatible providers surface an explicit error instead of silently stripping), #44310 (paste doesn't attach at all; here it attaches and persists, failing downstream).
Workaround: save the image to a file and have the agent Read it — tool-result images reach the model.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.