When an agent read the same image path several times while the file changed, every Read row showed the file's current contents, so the thread lost what the agent actually saw at each step. Read previews now show the image stored with that Read's result, and fall back to the file at the path only when the call kept no image (for example Codex image views).
workEntriesViewedImages / viewedImageOutputResource in client-runtime give each viewed image the call it came from and its stored tool-output-image asset.
- Web: the work-group image strip, its gallery, and the expanded Read row use the stored image via
ViewedImagePreview.
- Mobile: the image strip and expanded work-log row do the same via
ThreadViewedImage.
Fixes pingdotgg/t3code#41918
Reproduction on main#
Commit b3fff82014 (origin/main). Ran T3CODE_DEV_SEED=0 vp run dev in a fresh worktree (fresh database), paired the web client in the preview browser, picked Claude Haiku 5.5 and sent: write a red 100x100 PNG to /tmp/.../x.png with ImageMagick and Read it, overwrite it green and Read it, overwrite it blue and Read it (three separate Read calls). The agent replied: first read red, second green, third blue. In the timeline, the image under each of the three work groups was blue (pixels sampled: 0,0,255 for all three). Expanding a Read row shows two images: the path preview (x.png, blue in every row) and, below it, the 'Tool output image' from that Read's result, which is correct (255,0,0 in row 1, green in row 2). So the per-read bytes survive for Claude (served as tool-output-image) but the path-based preview, which is the one always visible, shows the file's current contents for every row. Failing test: apps/web/src/components/chat/MessagesTimeline.browser.test.tsx 'previews each Read of an overwritten image from what that Read saw, not the path': two Reads of /repo/shot.png in separate work groups both request one identical media-file resource (expected >=2 distinct, got 1); the other 75 tests in the file pass.
Evidence#
Being captured: before and after in the real app. This section is filled in before the pull request can merge.
Tests#
vp test run src/components/chat/MessagesTimeline.browser.test.tsx -t "overwritten image" without the fix (apps/web): 1 failed, expected 1 to be >= 2
vp test run src/components/chat/MessagesTimeline.browser.test.tsx src/components/chat/MessagesTimeline.logic.test.ts (apps/web): 197 passed
vp test run src/work-log/presentation.test.ts (packages/client-runtime): 20 passed
vp test run src/lib/threadActivity.test.ts (apps/mobile): 57 passed
vp run typecheck in apps/web, apps/mobile, packages/client-runtime: no errors
vp run check:changed: format, lint, knip, typecheck (7 packages), tests (4 files), react compiler all pass
Not in this change#
- Within one work group, several Reads of the same path still show one image in the strip (the first Read's); showing one image per Read would change the strip's layout.
- An expanded Read row shows the same image twice: once at the top and again as 'Tool output image' further down; that duplicate was there before.
- On web, a stored image from a Read offers the actions of a stored image rather than file actions on the workspace path.
- If a stored image fails to load, the web group gallery skips it from the surrounding images (the clicked one still opens); the strip and expanded row fall back to the file.
Who did the work#
- Written by Claude Opus 5.5, in Claude Code
- Reviewed by GPT-6.1 Sol, in Codex, and by Claude Opus 5.5, each on its own
- Proof captured by GPT-6.1 Sol and checked by Claude Opus 5.5
Run by the t3code factory in T3 Code.
Walkthrough
Viewed-image entries now retain per-read identifiers instead of carrying only image paths. Web and mobile renderers use those records to select the corresponding output resource when available, with path-resolved assets as a fallback.
Changes: Viewed image rendering
packages/client-runtime/src/work-log/presentation.tsViewedImagerecords, collects distinct records in viewing order, and creates an output resource when the record indicates stored output.apps/web/src/components/chat/MessagesTimeline.logic.ts,apps/web/src/components/chat/TimelineWorkEntryRow.tsx,apps/web/src/components/chat/TimelineWorkGroupRows.tsx,apps/web/src/components/chat/MessagesTimeline.logic.test.ts,apps/web/src/components/chat/MessagesTimeline.browser.test.tsxapps/mobile/src/lib/threadActivity.ts,apps/mobile/src/features/threads/thread-work-log.tsx,apps/mobile/src/features/threads/ThreadFeed.tsxEstimated code review effort: 3 (Moderate) | ~25 minutes
Change: Bug fix · Severity of issue fixed: Medium
Possibly related issues
Suggested reviewers:
maria-rcks,2sincejulyMerge Risk:
Low · up to
12760Each Read preview now shows the image stored with that call. A gallery can omit an image whose stored copy fails to load even though its thumbnail still shows, and the new regression test would not catch a preview that renders the shared path. These are small, easy fixes to make before or soon after merge.
Pre-merge checks:
3 · 
1
#41…#41918asks that each Read row show the image that Read returned, and that a new Read show the new picture. The PR addsworkEntriesViewedImagesandviewedImageOutputResourcein `packages/cli…client-runtimework-log presentation, the web timeline logic, row components and tests, and the mobi…Full details: Title check
Explanation
The title names the main change: Read rows now show the image each Read returned instead of the file's current contents. It uses a conventional commit prefix and matches the changeset, which adds per-call viewed-image data and uses stored tool-output images in web and mobile previews.
Full details: Linked Issues check
Explanation
Issue
#41918asks that each Read row show the image that Read returned, and that a new Read show the new picture. The PR addsworkEntriesViewedImagesandviewedImageOutputResourceinpackages/client-runtime/src/work-log/presentation.ts. Each viewed image keeps its call'sitemIdandthreadId. WhenhasOutputis true, the row resolves to that call'stool-output-imageasset at index 0, so each row loads its own stored bytes. Web (ViewedImagePreviewinTimelineWorkEntryRow.tsx,TimelineWorkGroupRows.tsx) and mobile (ThreadViewedImage,thread-work-log.tsx,ThreadFeed.tsx) use this resource first and fall back to the path asset. The new browser testpreviews each Read of an overwritten image from what that Read saw, not the pathcovers the regression. The PR reports it fails without the fix and passes with it. The PR also reports that the other tests and typechecks pass. Remaining uncertainty: whenstructuredPayloadis absent,hasOutputis set to true, so the stored resource is requested. The fallback to the path depends on the URL state reachingFailure. The PR description also says the 'Evidence' section (before and after capture) is still pending. That item is not a coding requirement.Full details: Out of Scope Changes check
Explanation
All changed areas serve the viewed-image preview behavior in the linked issue. The changes are in
client-runtimework-log presentation, the web timeline logic, row components and tests, and the mobile thread feed, work-log, and activity code. The API change fromworkEntriesViewedImagePathstoViewedImagerecords is needed to carry per-call identity. The test helper and fixture updates follow from that API change. The PR does not change server code, and the issue's server-side byte stripping is not altered. The excluded scope (multi-image strips for repeated Reads, duplicate image in expanded rows, file actions on web, gallery skipping failed images) is stated in the PR and does not add unrelated code. No change was found that is unconnected to the issue.Full details: Description check
Explanation
The description follows the template sections: Problem, Change, Scope, Verification, and Who did the work. It explains the bug, the per-call stored-image fix, and the path fallback. It links issue
#41918and gives a reproduction on main, specific test results, and known limitations. The Evidence section is still a placeholder saying before/after captures are pending, and the template requires before/after screenshots for UI changes. The Scope section cites the issue but does not explain why the change is a bug fix rather than a feature.Resolution
Fill in the Evidence section with before and after screenshots of the Read preview in the web and mobile apps, as the template requires for UI changes. Add a short statement in the Scope section that this is a bug fix, and confirm the linked issue covers it. The description is otherwise complete.
Finishing Touches
Generate unit tests (beta)