Repository navigation
Description
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/web
Steps to reproduce
- In a Claude thread, ask the agent to view an image, e.g.
shot.png. - Change
shot.pngon disk by overwriting it in place, then ask the agent to view it again. - Expand both "Read" rows in the work log.
Expected behavior
Each row shows the image that read returned. At minimum, the second row should not show the old bytes.
Actual behavior
Both rows show the first version of the image. The second row looks like a per-path cache that never notices the file changed.
Impact
Minor bug or occasional failure
Version or commit
main @ e2cc34f
Environment
Linux, T3 Code desktop, Claude provider
Cause
For image reads, the server drops the base64 bytes from the stored tool output (apps/server/src/orchestration-v2/toolOutputImageBytes.ts) and keeps only viewedImagePath. When a row is expanded, the image is loaded again from that path:
resolveMediaSourcebuilds{ _tag: "media-file", threadId, path }(packages/client-runtime/src/mediaSource.ts).assetEnvironment.createUrlis a query atom keyed on(environmentId, resource). It is fresh for 5 minutes, kept for 60 minutes when idle, and refreshed every 30 minutes (packages/client-runtime/src/state/assets.ts). Two reads of one path in one thread share one atom, so they get the same signed URL.- That URL is served with
Cache-Control: private, max-age=3600(apps/server/src/http.ts), and the browser's image cache is keyed by URL too. A repeated URL keeps showing the old pixels. - The signed token records the file's device and inode, not its content. An in-place overwrite keeps the old URL valid. An atomic replace (write to a temp file, then rename) gives a new inode, so the cached URL fails until it is minted again.
The mobile work log reads viewedImagePath the same way (apps/mobile/src/features/threads/thread-work-log.tsx).
Possible fixes
1. Key the cached URL by the tool call, not just the path. Add an optional cache-key hint (the turn item id) to the media-file resource the viewed-image preview uses, the way project-favicon already carries one. Each read row then gets its own URL atom, so a later read mints a fresh URL when it's expanded. The server already signs a new URL on every image mint, so the browser fetches the current bytes. The downside: the preview still shows the file as it is now, not as the agent saw it. A row expanded before the change keeps its old URL, and two rows both expanded after the change show the same newer image. History stays inaccurate.
2. Keep the bytes the agent saw. Keep image blocks from read results that fit under MAX_TOOL_OUTPUT_IMAGE_BASE64_LENGTH, and serve them through the existing tool-output-image resource (threadId, itemId, index). Fall back to the path when there are no bytes. This makes history accurate, but every viewed image ends up in the database, twice (event log and projection). Screenshot-heavy threads would grow quickly, and the current stripping looks deliberate.
A middle ground is to record a content hash at read time, so a row can say the file has changed since the agent viewed it.
Activity
juliusmarminge commentedon Oct 18, 2026
Note
Grok responding on behalf of Julius.
Thanks for the detailed write-up. This is the same bug as #13138 (image previews in expanded read rows keep showing the first version after the file is overwritten), which is already accepted, and #14943 is the open fix for it. Closing this as a duplicate so the discussion stays in one place. Your notes on the per-path signed URL and the history-accuracy tradeoff would be a useful comment on #13138 or #14943.