fix(client-runtime): omit failed image reads from viewed-image previews #42265
Merged
Luzivog(GitHub profile, opens in a new tab)merged 3 commits into
main fromrefs/pull/42265/head·merged by juliusmarminge View on GitHubProblem#
Claude and ACP adapters tag viewedImagePath on Read tool items targeting image paths even when the read fails (for example, when the file does not exist). Because workEntryViewedImagePath in packages/client-runtime/src/work-log/presentation.ts does not check toolLifecycleStatus, the UI renders an Image unavailable card in both the collapsed work-log image strip and the expanded failed Read row, pushing down the tool's actual error text (Error: File does not exist.).
Change#
- Return
nullfromworkEntryViewedImagePathwhenentry.toolLifecycleStatus === "failed". - Because web (
MessagesTimeline.logic.ts,TimelineWorkGroupRows.tsx,TimelineWorkEntryRow.tsx), desktop, and mobile (threadActivity.ts,thread-work-log.tsx) all derive viewed-image previews throughworkEntryViewedImagePath/workEntriesViewedImagePaths, failed image reads drop their broken image cards across clients while the expanded row keeps displaying the target path and tool error output. - Kept strictly to the
workEntryViewedImagePathguard requested on #38219 (noworkEntryReadOutputchange and no unexercised"declined"status branch, since both web and mobile map failed reads to"failed").
Scope#
Fixes pingdotgg/t3code#38206. Cleanly replaces stalled #38219 with the minimal scope requested in https://github.com/pingdotgg/t3code/pull/38219#issuecomment-6956799748.
Verification#
- How the bug was found: Hit live on Antigravity (ACP) when speculative
Readcalls against missing.jpgpaths failed (status: "failed",output: "file does not exist"), triggeringAssetWorkspaceAssetNotFoundErrorand renderingImage unavailablecards in the work-log strip. - Unit tests (failed before fix, passed after):
packages/client-runtime/src/work-log/presentation.test.ts: failed before the fix (expected '/repo/missing.png' to be null), passes after (21 passed).apps/web/src/components/chat/MessagesTimeline.logic.test.ts: failed before the fix (viewed-imagesrow included/repo/docs/missing.png), passes after (122 passed).vp run check:changed:format,lint,knip,typecheck(7 packages), andtest(2 files, 143 tests) all pass.
- Real-app before/after proof (
vp run scenarios:proveagainstmain): Ran a deterministic local ACP agent reading one existing synthetic PNG (assets/chart-ok.png) and one nonexistent PNG (assets/chart-missing.png) in the real web app (Chromium headless, Linux).- Base (
90e6e3e69d): fails with 2Image unavailablecards (one in the collapsedRead 2 filesstrip, one inside the expandedRead demo/assets/chart-missing.pngrow above the error text). - Head (
e724afca21): passes with 0Image unavailablecards;chart-ok.pngstill renders in the strip and expanding the failed row shows the path andError: File does not exist.cleanly.
- Base (
- Not checked: Mobile native runtime was not launched; mobile shares
workEntryViewedImagePathandworkEntriesViewedImagePathsfrompackages/client-runtimeand already renders tool error output text on expanded rows.
| View | Before (main, 90e6e3e69d) | After (e724afca21) |
|---|---|---|
| Collapsed work-log strip | ![]() | ![]() |
| Expanded failed Read row | ![]() | ![]() |
Written and verified by Gemini 4 Neon in Antigravity (via T3 Code).




Evidence#
Replay a failed PNG Read and a successful PNG Read in one turn, then expand the work log, Read group, and failed row. Web, Chromium, light theme, 1440×1100, fresh synthetic state on each commit.
Base shows two Image unavailable cards; head shows zero. The missing-file path and ENOENT output remain, and the successful purple PNG still previews.
Scenario and replay driver
Not shown: