Skip to content

fix(chat): snapshot reused response images and stop caching live image URLs - #1866

Open
bdunn77 wants to merge 2 commits into
agent0ai:mainfrom
bdunn77:fix/chat-response-image-snapshots
Open

bdunn77 wants to merge 2 commits into
agent0ai:mainfrom
bdunn77:fix/chat-response-image-snapshots

Conversation

@bdunn77

@bdunn77 bdunn77 commented Aug 30, 2026

Copy link
Copy Markdown

Fixes #1865

Problem

Chat bubbles that embed generated images via live workdir paths (img:///a0/usr/workdir/logo.png or /api/image_get?path=...) do not keep a historical copy. Reusing the same filename overwrites the file, so older bubbles show the newest image. Reloading the WebUI makes this ubiquitous because replay re-fetches every URL from disk.

A second overlapping bug: /api/image_get served a generic fallback icon with Cache-Control: public, max-age=3600 when the file was missing. The browser could cache that icon under the PNG URL, so some bubbles failed to load even before a reload.

Browser screenshots and vision-load artifacts already use unique chat-scoped names. Response-embedded workdir images did not.

Fix

  • Snapshot finished response img:// / /api/image_get?path= local image refs onto unique files under usr/chats/<id>/images/response/.
  • Leave already chat-scoped artifacts and missing files unchanged.
  • Store parallel-worker snapshots on the parent chat id.
  • Stop caching missing-file fallback icons (no-store). Revalidate mutable workdir files (no-cache). Keep max-age=3600 only for unique chat artifacts.

This is forward-looking. Already overwritten files cannot be restored from chat.json.

Tests

/opt/venv-a0/bin/python -m pytest tests/test_image_get_security.py tests/test_chat_media_response_snapshots.py -q --tb=short

13 passed.

Notes

  • Searched open/closed issues and PRs; no existing community fix for this.
  • Target is main, matching current comparable upstream PRs.

…e URLs

Chat markdown historically embeds live workdir paths such as
img:///a0/usr/workdir/logo.png. Reusing that filename overwrites the file,
so older bubbles show the newest image after a UI reload. Missing files also
returned a fallback icon with max-age=3600, so the browser could cache the
icon under the PNG URL.

Copy finished response image refs onto unique chat artifacts and only cache
immutable chat-scoped files.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reused workdir image filenames overwrite earlier chat bubbles after UI reload

1 participant