GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(app): opt into experimental-media-uri and keep draft media bytes local by kitlangton · Pull Request #58743 · anomalyco/opencode

Conversation

@kitlangton

@kitlangton kitlangton commented Oct 24, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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 on experimental.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

  1. The app's API client sends X-OpenCode-Capabilities: experimental-media-uri.
  2. A per-server cache fetches bytes through experimental.media.get with the server's auth, turns them into object URLs and revokes the oldest beyond 128. Message attachments render from it.
  3. Drafts own their bytes. A 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.
  4. Undoing a queued prompt, reverting one that hasn't been delivered yet, and editing a queued prompt all end in an inbox cancel, and the cancel sweeps blobs nothing else references. Each one first copies the prompt's 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; only media:<hash> refs are. Not verified end-to-end in the desktop app against a live server with the flag on.

Proof

  • bun test --conditions=solid on drafts.test.ts, image.test.ts, queue.test.ts and prompt.test.ts (packages/app): 72 pass. They cover draft save and restore with media: 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=browser on draft-history-cache.test.ts and prompt-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. oxlint on changed files: 0 errors.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@github-actions github-actions Bot added the contributor label Oct 24, 2026
This was referenced Oct 24, 2026
feat(core): store session media as media:<hash> refs in a content-addressed blob table #58656
Merged
feat(core): opt-in blob writes for session media behind experimental.media_blob #58741
Merged
feat(core): add byte-preserving offline media_blob backfill for legacy rows #58742
Closed
feat(server): add experimental GET /api/experimental/media/:hash and opt-in experimental-media-uri capability #58657
Merged
@kitlangton
kitlangton force-pushed the media-wire branch from 452ae37 to dd4ee3b Compare October 24, 2026 21:27
@kitlangton
kitlangton force-pushed the media-app branch from 9be09e1 to c7b7f11 Compare October 24, 2026 21:27
@kitlangton kitlangton changed the title feat(app): opt desktop and web into media-uri with LRU blob cache feat(app): opt into experimental-media-uri and keep draft media bytes local Oct 24, 2026
@kitlangton
kitlangton force-pushed the media-wire branch from dd4ee3b to c0ffb14 Compare October 25, 2026 20:19
@kitlangton
kitlangton force-pushed the media-app branch from c7b7f11 to d4d9b98 Compare October 25, 2026 20:20
@kitlangton
kitlangton force-pushed the media-wire branch from c0ffb14 to 9f57289 Compare October 25, 2026 23:02
@kitlangton
kitlangton force-pushed the media-app branch from d4d9b98 to d69c3e4 Compare October 25, 2026 23:02
kitlangton added 4 commits October 25, 2026 16:37
@kitlangton
feat(app): opt desktop and web into experimental-media-uri with LRU b…
43fa284
…lob cache
@kitlangton
fix(app): keep draft media bytes local, resolve media: refs through t…
d6ee0ac
…he media loader, and submit bytes
@kitlangton
fix(app): take stored media as the media:<hash> refs the server sends
4132d0c
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.
@kitlangton
fix(app): pin media: attachments before cancelling their inbox item
4259705
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
kitlangton force-pushed the media-wire branch from 9f57289 to 8aea935 Compare October 25, 2026 23:38
@kitlangton
kitlangton force-pushed the media-app branch from d69c3e4 to 4259705 Compare October 25, 2026 23:38
Base automatically changed from media-wire to media-backfill October 25, 2026 23:38
@kitlangton
kitlangton merged commit 4259705 into media-backfill Oct 25, 2026
6 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@kitlangton
kitlangton deleted the media-app branch October 25, 2026 23:38
@kitlangton
kitlangton restored the media-app branch October 25, 2026 23:38
@kitlangton kitlangton mentioned this pull request Oct 25, 2026
feat(app): opt into experimental-media-uri and keep draft media bytes local #59104
Merged
@kitlangton

kitlangton commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #59104 (GitHub auto-marked this merged into the stack base during a reorder; nothing reached dev).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ksy90101 ksy90101 mentioned this pull request Nov 18, 2026
feat(opencode): 세션 미디어를 media:<hash> 참조로 blob 테이블에 한 번만 저장 team-monolith-product/enk-opencode#347
Draft
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@Hona Hona Awaiting requested review from Hona Hona will be requested when the pull request is marked ready for review Hona is a code owner
@Brendonovich Brendonovich Awaiting requested review from Brendonovich Brendonovich will be requested when the pull request is marked ready for review Brendonovich is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

contributor

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@kitlangton
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.