Skip to content

fix(native): refresh chat images after workspace mutations - #186

Merged
rynfar merged 3 commits into
nativefrom
nw/153-asset-revisions
Nov 4, 2026
Merged

rynfar merged 3 commits into
nativefrom
nw/153-asset-revisions

Conversation

@rynfar

@rynfar rynfar commented Nov 4, 2026 •

Copy link
Copy Markdown
Owner

Fixes #153. Host images in native stayed cached after agents rewrote their files. This ports the chat asset behavior from e0f69e9ea4: finished file tools, commands, dynamic/MCP tools, subagents, and the last app checkpoint drive the media scope used by markdown and transcript images. Thread synchronization caches the mutation id; scrolling and transcript rendering read the cached value.

The core state machine shares the first in-flight mint, waits and re-mints for a later mutation, recognizes reverts, and retains the shown URL for the same server fileRevision with more than five minutes remaining. On a byte-cache miss, it requires fresh signing if the shown URL is expired or within that margin. A successful mint suppresses further freshness-driven renewals for 30 seconds while allowing GETs, even with a short TTL or client/server clock skew. Rejected-fetch invalidation overrides that grace, so the next load re-mints even without a new mutation; a late failure cannot invalidate a newer URL. Encoded-byte hits and already decoded images do not trigger these extra mints.

The client decodes optional revision metadata and separates signing from fetching. Pixel/encoded cache identity uses fileRevision (the URL when absent), so re-signing does not reload unchanged bytes. Revision records cap at 512 resources; eviction conservatively re-mints on the next read. Existing byte budgets also have entry limits. The only edit in #160's files is the media-scope field in thread_view/rows.rs.

Core regressions cover every upstream added assets/thread-detail case, plus expiry boundaries, legacy metadata, checkpoint filtering, content-cache identity, same-mutation remount after expiry, signed-fetch failure, failure during an in-flight mutation mint, and repeated fetches after successful short-lived or clock-skewed renewals. Review failing-first proof: /private/tmp/native-factory-2f5f764a/evidence-153/review-expiry-failing.log. Passing regressions: review-expiry-tests.log in the same directory. The renewal-loop regression also failed first (review-loop-failing.log) and passes in review-loop-tests.log. Original failing-first logs are preserved there too.

Validation: workspace tests, clippy with warnings denied, snapshot build, theme generation check, 42 parity-sync tests, TypeScript conformance generation check, and vp run check:changed. Final rebased gate logs live under /private/tmp/native-factory-2f5f764a/evidence-153/ with the review-r4- prefix.

The read-only 14658 smoke probe fetched an existing SVG, received optional fileRevision, and confirmed that a second mint re-signed the URL while the shown URL stayed unchanged. Probe source/transcript and before/after offscreen showcase captures are in /private/tmp/native-factory-2f5f764a/evidence-153/; the final smoke capture is review-r4-showcase-after.png. They are general rendering evidence, not a live rewrite or expiry UI capture; those transitions are covered by core tests. No paid turns or server changes.

Both ledger rows remain partial. TR-MEDIA points at #187, which tracks video playback; images inline with prose; images in rendered Markdown file previews; local-media fallback; periodic signed-URL refresh for long-mounted images; and an already-open image file preview skipping the first null-to-non-null mutation. These preview paths are outside the chat asset path covered here. TV-STREAM's Issue column stays empty; its broader parity was not audited.

Built with GPT-6.1 Sol in Codex

@rynfar
rynfar force-pushed the nw/153-asset-revisions branch from 07d673f to 02bb9fb Compare November 4, 2026 00:46
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.

1 participant