[Bug]: Image previews don't update when file updates #13138
Before submitting#
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area#
apps/desktop
Steps to reproduce#
This is reproducible on linux and windows
- Make a new thread
- Tell the agent "Can you make a 100x100 image that is red, then read it. then fully overwrite it to be green. then read it. then fully overwrite it to be blue. then read it"
- Expand the inspected image tool outputs as it works
- Notice that the first one is seemingly cached, but doesn't update when changed
Expected behavior#
The preview should update to the latest state as it reads the files again, if the file has changed. Just like the files tab.
Actual behavior#
The preview uses the first read image without checking to see if it has updated since, if the file has been overwritten, therefore leading to the illusion that the file hasn't been updated.
Impact#
Cosmetic issue
Version or commit#
0.0.43-nightly.20260922.2110
Environment#
Windows 11 desktop app, both on T3 Connect to a linux machine & on Windows locally
Logs or stack traces#
Screenshots, recordings, or supporting files#
Screenshot 2026-09-22 233234.png Screenshot 2026-09-22 233446.png
Workaround#
Previewing the file you want to track in the files tab works and updates properly.
CowgillAlex(GitHub profile, opens in a new tab) added labelsbug
CowgillAlex(GitHub profile, opens in a new tab) added labelsneeds-triage
Confirmed. Expanded image reads in the thread are live lookups of the path, and the browser is allowed to keep the first response.
WorkLogEntryRowrenders the viewed file withChatMarkdownAssetImage(apps/web/src/components/chat/MessagesTimeline.tsx). That resolves to onemedia-filesigned URL per path (resolveViewedImageAsset). The URL is cached client-side for 5 minutes, and image responses are sent withCache-Control: private, max-age=3600(assetResponseHeadersinapps/server/src/http.ts). The<img>srcdoes not change when the file is overwritten, so later reads of that path keep painting the first bytes. Audio and video host files are alreadyno-store; images are not.no-storealone would still not repaint an image that is already mounted.The files tab avoids this.
WorkspaceImagePreviewappendsworkspace-revisionfromworkspaceMutationId, whichChatViewalready updates after a completed file change or command. That id is not passed into the chat preview. Your note onChatMarkdown.tsx,http.ts, andFilePreviewPanel.tsxmatches this.One extra trap for the fix: chat previews are
media-filetokens pinned to device and inode (openMediaFile). The files tab usesworkspace-fileand re-resolves the path. Cache-busting the existing chat URL updates an in-place overwrite, but a delete-and-replace can 404 that token until it is signed again. The change should bumpsrcwith the workspace revision and re-sign (or serve the preview asworkspace-file) when the workspace mutates. Same gap on mobile:renderViewedImageloadsThreadMarkdownImagefrom the signed URL with no revision.Desktop is the shared web UI. No contract change. Cosmetic, and worth fixing so a second read of an overwritten image matches the files tab.
juliusmarminge removed labelsneeds-triage
juliusmarminge added labelsaccepted
juliusmarminge added labelsvia-triage
Still reproduces on
0.0.46-nightly.20261003.2632, and currentmain(98beed1a) has the same code path. Real case: an agent Reads/tmp/cur_small.pngagain and again while driving a phone. The agent's text describes the new screenshot (a YES/NO transfer dialog), but the expanded Read row shows an older capture. Only the UI is affected. The model gets the right bytes.Root cause: a Claude
Readimage row is not drawn from the tool result.workEntryViewedImagePath→resolveViewedImageAsset(packages/client-runtime/src/work-log/presentation.ts) turns the row into amedia-file { threadId, path }asset. That means:- Every Read of the same path resolves to the same resource. The
createUrlatom family caches it withASSET_URL_IDLE_TTL_MS= 1h. The file response is also sent withCache-Control: private, max-age=3600(apps/server/src/http.ts). So later rows show whatever was loaded first. - Without caching, every row would instead show the file as it is now. That is also wrong for older rows.
Suggested expectation: each Read row should show the bytes that call returned, not a newer version of the file. #16199 added
tool-output-image { threadId, itemId, index }for MCP screenshots, and its notes say ClaudeReadrows "already show the file from its path". Serving Read images throughtool-output-image(Claude stores the{ source: { media_type, data } }shape that the parser already handles) would fix this, withmedia-fileas a fallback only when the bytes weren't stored.- Every Read of the same path resolves to the same resource. The
Following up from #21296, which I filed by mistake as a duplicate of this.
On serving Read images through
tool-output-image: since #16652, the server no longer keeps those bytes.stripUnservedToolOutputImageBytes(apps/server/src/orchestration-v2/toolOutputImageBytes.ts) removes the base64 from a Read result before it is stored, because the row loads fromviewedImagePathanyway. So that route means reversing #16652 for Read results underMAX_TOOL_OUTPUT_IMAGE_BASE64_LENGTH. Every viewed image would then be stored twice, once in the event log and once in the projection. Threads where an agent keeps re-reading a screenshot would grow quickly.The
scopecache key in #14943 avoids that cost, and it fixes the case in this report. The remaining gap is history: a row shows the file as it was when that row signed its URL, not the bytes the call returned. If the history gap matters, a cheaper option is to record a content hash at read time. A row could then say the file has changed since the agent viewed it, without storing the image.Reproduced on Linux in the real web dev app at 3b95e7831b, using Claude Sonnet 5.5. Ran the red/read → green/read → blue/read sequence, expanded the Read previews, then overwrote the same PNG red and read it again. The new expanded Read row still rendered blue (RGB 0,0,255), while the PNG on disk was red (RGB 255,0,0). The agent received and described the updated image.

Reproduced on 3b95e7831b: later expanded Read rows reused the first image URL. Fix and before/after recordings are in #23510. The final-head web replay displays red, green, then blue; 22 focused tests pass. Native iOS verification is blocked by GhosttyKit build errors on both baseline and head; Electron is unverified on this Linux VM.
juliusmarminge closed this
Sign in to join this conversation.
Codex says this, it may be useful:
The chat preview reuses the same signed image URL when the file changes (ChatMarkdown.tsx). The server allows that URL to be cached for an hour (http.ts). Because the image’s
srcdoes not change, the browser can keep showing the old bytes.The file preview panel avoids this by adding a workspace revision to its URL (FilePreviewPanel.tsx). The chat preview has no equivalent.