Repository navigation
feat(app): opt into experimental-media-uri and keep draft media bytes local - #58743
Merged
Merged
Conversation
This was referenced Oct 24, 2026
Merged
kitlangton
force-pushed
the
media-wire
branch
from
October 24, 2026 21:27
452ae37 to
dd4ee3b
Compare
kitlangton
force-pushed
the
media-wire
branch
from
October 25, 2026 20:19
dd4ee3b to
c0ffb14
Compare
kitlangton
force-pushed
the
media-wire
branch
from
October 25, 2026 23:02
c0ffb14 to
9f57289
Compare
…he media loader, and submit bytes
The server sends media:<hash> refs, never route paths, and user files keep their source, so drop the legacy route parsing and the origin fallback.
Reverting an undelivered prompt, undoing a queued prompt and editing one all end in an inbox cancel that sweeps blobs nothing else references. Each now copies its media: bytes through the media cache into local draft blobs first; revert and undo leave the prompt queued when the bytes cannot load.
kitlangton
force-pushed
the
media-wire
branch
from
October 25, 2026 23:38
9f57289 to
8aea935
Compare
Contributor
Author
|
Superseded by #59104 (GitHub auto-marked this merged into the stack base during a reorder; nothing reached dev). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What it does
Desktop and web ask for
media:<hash>refs, so a long session with screenshots stops re-sending every image as base64 each time it loads. Images load on demand through a cache instead. It's experimental: nothing changes until a session's location turns onexperimental.media_blob, which is off by default. Until then the server keeps sending inline data.Stack, built on the merged #58656: write (#58741) → backfill (#58742) → wire (#58657) → app (this PR).
Why
Inline media is a third larger than its bytes and arrives again on every message read, for every image in the session. With refs, each image is fetched once per server and cached. Before → after bytes per load have not been measured yet.
How it works
X-OpenCode-Capabilities: experimental-media-uri.experimental.media.getwith the server's auth, turns them into object URLs and revokes the oldest beyond 128. Message attachments render from it.media:image restored into the composer is copied into the local draft store on the first save, so server-side cleanup can't break a draft. Submitting always sends bytes.media:bytes through the cache into local draft blobs. If undo or revert can't load them, they show an error and leave the prompt queued. Edit swaps in the local copies as they load.Risk
App UI and draft persistence. If a media load fails, the image shows as unavailable and the draft stays intact. Tool-result images are not shown from refs yet. Legacy
/api/media/URLs are not supported; onlymedia:<hash>refs are. Not verified end-to-end in the desktop app against a live server with the flag on.Proof
bun test --conditions=solidondrafts.test.ts,image.test.ts,queue.test.tsandprompt.test.ts(packages/app): 72 pass. They cover draft save and restore withmedia:refs, a submit after the server swept the blob, and undo pinning media before the cancel (and not cancelling when the bytes are gone).bun test --conditions=browserondraft-history-cache.test.tsandprompt-persistence.test.ts(packages/app): 18 pass.bun test src/components/message-file.test.ts(packages/session-ui): 3 pass.bun run typecheck(app, session-ui): clean. Prettier: clean.oxlinton changed files: 0 errors.