Repository navigation
Description
Before submitting
- I searched existing issues and did not find an exact OpenCode duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/server — OpenCode V2 provider adapter / tool-result attachments
Steps to reproduce
- Use T3 Code Nightly with OpenCode V2 and an OpenAI Responses-capable model that can run the hosted
image_generationtool. The observed model wasgpt-6.1-solthrough a custom relay. - Send:
Generate an image of an orca holding an apple, animated. - Let the turn complete. The observed run used native
image_generation. - Inspect the conversation and compare T3's stored activity with the corresponding OpenCode session message.
Expected behavior
A successful tool result containing an image is visible in the conversation, with a way to view or save it. The image remains available when the thread is reopened or the provider session is reconciled. This should not require the model to repeat the image in a final Markdown reply.
Actual behavior
The image was actually generated. The stored OpenCode assistant message contains a completed tool result with a PNG data URI. Decoding that URI recovered a valid image of the requested scene:
- PNG dimensions: 1312 × 1199.
- Decoded size: 2,434,757 bytes.
- The image was recovered from the existing message; no repeat generation was needed.
OpenCode's result shape, with bytes and unrelated metadata omitted:
{
"type": "tool",
"name": "image_generation",
"executed": true,
"state": {
"status": "completed",
"input": {},
"content": [
{
"type": "file",
"uri": "data:image/png;base64,<omitted>",
"mime": "image/png"
}
]
}
}The corresponding T3 activity contains:
{
"toolName": "image_generation",
"input": {},
"output": ""
}Source investigation
The same text-only conversion is present on current main at 5307c233b1f0ae72b8894dd39d94019aaf9e7cb8. Downloaded source files were checked against that commit's blob hashes.
In packages/provider-opencode/src/server/v2/adapter.ts:
textOf, lines 502–503, keeps onlytype === "text"blocks.- The live
session.tool.successhandler, lines 1998–2018, passestextOf(event.data.content)to the completed tool output. - History backfill, lines 2431–2445, also uses
textOf(part.state.content).
Thus a file-only result becomes an empty string before client rendering. A mixed text/file result also loses its file block. A small local check of this conversion confirmed both cases; the full repository test suite was not run, and no fix was implemented.
Both the live-event and saved-history paths appear to need a way to retain supported file/image results through T3's media/attachment handling. Large base64 bodies should not simply be copied into ordinary timeline text. Useful test cases include file-only results, mixed text/file results, native hosted tools, history backfill/reconnect, and a settled turn with no assistant text.
Configuration checked
The OpenCode provider guide supports OpenCode 2.0.18 and newer; this environment uses 2.0.29. Neither that guide nor the OpenCode provider settings schema exposes an image-output switch. The text-only conversion above is unconditional, so this does not appear to be a missing image-display setting.
Impact
Major degradation: generation succeeds, but its only deliverable is hidden and the successful status gives no indication of the missing output. Observed once for this exact OpenCode reproduction; repeat live generation, other clients, and a patched build were not tested.
Version or commit
- T3 Code Nightly: 0.1.1-nightly.20261018.3331, verified from the installed app's Info.plist.
- OpenCode: v2.0.29.
- Source gap checked on
mainat 5307c23.
Environment
macOS 27.0 (26A428), arm64, desktop app, OpenCode provider, gpt-6.1-sol through a custom relay, full-access mode. Observation date: 2026-10-19.
Workaround
Recover the PNG data URI from the stored OpenCode message, save it to a local file, and return an explicit Markdown image or a file link. The recovered PNG was checked and a Markdown embed was sent, but its final display in the user's client was not independently verified. No additional relay or model-capability overrides were needed to recover the bytes.
Related reports
- [Bug]: Codex generated images are missing from V2 output unless the reply embeds them #15420: Codex native
imageGenerationoutput is missing unless the reply embeds it. - [Bug]: Codex image generation returned through functions.exec is invisible on Windows desktop and Android #19059: Codex image blocks returned through
functions.execare invisible. - [Feature]: Codex image generation support #2398: earlier Codex image-generation support report, now closed.
These describe similar symptoms, but this report identifies the distinct OpenCode V2 Tool.FileContent → text-only output path. Targeted searches for image_generation, OpenCode image output, and textOf found no exact existing issue.
Prepared by an AI agent (GPT-6.1 Sol through OpenCode), at the affected user's request, using their screenshot, stored T3/OpenCode records, recovered image bytes, and upstream source.
Activity
juliusmarminge commentedon Oct 19, 2026
Note
Grok responding on behalf of Julius.
Thanks for the detailed report. Confirmed on current main.
textOfkeeps only text blocks (packages/provider-opencode/src/server/v2/adapter.ts:502-503). Both the live tool result (adapter.ts:2012-2016) and history backfill (adapter.ts:2442) use it, so a file-only result is stored as an empty output and the image is lost before the client sees it.This is the OpenCode side of the gap tracked in #15420 for Codex. In both cases the generated image only shows up if the final reply embeds it. The data differs, though. Codex leaves a saved file, and OpenCode returns the image bytes inline, so this one stays a separate issue.
Accepting this as a bug.
sauravhiremath commentedon Oct 24, 2026
Do we have any update on this? I see we have a PR open for this - lemme know if any help needed from me
fixfon commentedon Oct 25, 2026
Thanks for checking in. #21796 is open for this: it keeps image blocks (raster images sent as base64 data: URIs) in the V2 tool results, both live and when history is backfilled, and the tests cover interleaved text and images. It's waiting on review.
juliusmarminge commentedon Nov 9, 2026
Thanks for the detailed report! #30389, merged as d51bc58f, preserves OpenCode image results in both live output and history so they can be viewed in tool details.