Repository navigation
Conversation
…anges and session reopen What changed: - Add conditional GET (If-None-Match / ETag -> 304 Not Modified) to opencode_kit::client::Server::get_bytes_if_modified, matching the server's /api/fs/read/* validators (packages/server/src/handlers/fs.ts:124-137). - Replace MdStore's permanent path-keyed slot cache with an explicit slot state machine (crates/session-view/src/images/markdown/slot.rs: Fetching, FetchingDirty, Decoding, Held, Stale, Reloading, ReloadingDirty, Promoting, Failed) plus invalidate_file, invalidate_directory, invalidate_all_files, and set_conditional_fetch. - Wire apps/desktop to use conditional fetches in boot.rs and invalidate affected local markdown images on filesystem.changed / file.edited, session.tool.success (exact paths for file-targeted tools, lazy ETag-preserving invalidation for arbitrary mutating tools like bash), session.step.ended file lists, session.revert.committed, Incoming::Reconnected, and session switches/reopens in open_now. - Add the Timeline/Inline image update story covering file-change, bash-tool, and session-reopen updates. Why and replaced behaviour: - Previously, MdStore::slots cached local markdown images indefinitely by (directory, path) with no invalidation (even rest() kept stale bytes in Slot::Held), so overwriting an image at the same path left inline markdown images stale while content-addressed tool-result thumbnails, their lightbox, and the Files panel showed the new file. - Replaced permanent path caching with lazy invalidation and If-None-Match revalidation that keeps the previous ready picture visible through Stale -> Reloading -> Promoting until the new decode is ready, preventing blank flashes or row-height shifts. Older replies referencing the same path also update to the current file on disk, matching the Files viewer. Verified: - Headless Timeline/Inline image update before fix reproduced stale inline V1 beside fresh V2 tool thumbnail across File changed, Bash tool, and Reopen session variants. - After fix, all three variants update inline images to V2; unchanged images stay cached (0 extra fetches on File changed, 304 Not Modified with 0 body downloads on Bash tool and Reopen session); 60 fps swap capture shows zero blank frames and identical row rect (delta-y = 0.0, delta-h = 0.0). - scripts/guardrails.sh (11/11), cargo check --locked -p session-view --examples, cargo check --locked -p opencode-desktop --no-default-features --features knobs, and cargo clippy on opencode-kit / session-view all pass with no new warnings.
…lots, and refine invalidation triggers Addresses PR #2035 review findings on top of 0711001: - Keep Held and Stale entries revalidatable without flashing blank: introduce HeldBytes, StaleHeld, ReloadingHeld, and ReloadingHeldDirty in MdStore's slot state machine; rest() demotes all pixel-holding states to zero-pixel held equivalents (preserving bytes and ETags); invalidating Held revalidates silently via If-None-Match (no version bump until new pixels finish decoding, so 304 Not Modified causes zero downloads, zero decodes, and zero blank frames). - Settle off-screen Promoting slots: add SlotEvent::Settle run from poll(), land(), trim_pinned(), and rest(), and make off-screen Promoting slots evictable under pixel/byte budgets so reloads landing while scrolled away or after a tab switch release previous pixels immediately. - Add MdStore::revalidate_file (keeps ETag) and use it for read-only tool hints (read) so unchanged images answer 304 Not Modified instead of a full 200 download. - Remove unused file.edited match and handle session.shell.ended (user !cmd runs, packages/core/src/session/session.ts:232-240) and shell.exited (background shells) in apps/desktop/src/session/events/images.rs. - Delegate path equality and directory containment to opencode_kit::path::{same,contains,windows} (moving source/path parsing into crates/session-view/src/images/markdown/source.rs) so case folding follows path shape regardless of client OS. - Drop SlotEffect::Enqueue and eager URL-heuristic re-enqueue in land(); dirty in-flight fetches settle lazily to None / Stale / StaleHeld. - Avoid double MdStore::changed() call in set_conditional_fetch. - Extend Timeline/Inline image update story with Held 304 and Off-screen reload variants. Verified: - All 5 story variants pass headlessly: File changed, Bash tool, Reopen session, Held 304 (chart_200=1 chart_304=1 unchanged_200=1 unchanged_304=1 decoded_pics=0, zero blank frames across 60 fps held-304.mp4), and Off-screen reload (decoded_pics=2 after V2 lands off-screen at y=-759.0). - 60 fps swap.mp4 still shows zero blank frames and identical row rect (delta-y = 0.0, delta-h = 0.0). - scripts/guardrails.sh (11/11), cargo check --locked -p session-view --examples, cargo check --locked -p opencode-desktop --no-default-features --features knobs, and cargo clippy on session-view / opencode-desktop pass with zero warnings in touched files.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An inline image in a reply shows the file's current content after the file is overwritten at the same path.
🔍 Origin: seen in real use. A reply showed a generated PNG inline; the assistant then overwrote the same file, and the next reply's inline image still drew the old pixels, while the tool thumbnail's zoom view and the Files panel showed the new file.
❌ Before
MdStorecached local markdown images by (directory, path) for good, with nothing that invalidated a slot.✅ After
filesystem.changed/file.edited, a tool result that wrote the path (any mutating tool such as a shell marks the directory's images for a lazy recheck), a step's file list, a revert, a reconnect, and a session switch or reopen.If-None-Matchagainst the server's/api/fs/readETag: 304 keeps the decoded picture, 200 downloads the new bytes.images/markdown/slot.rs).Consequence: an older reply that references the same path also shows the current file, as the Files panel does. There is one file; old versions are not snapshotted.
slot.rs, the invalidation call sites inapps/desktop/src/session/events, and the conditional GET inopencode-kit'sclient/http.rs.Checks run
Timeline/Inline image update(variants: File changed, Bash tool, Reopen session), headless: before the fix the inline image stays on the old version beside a fresh tool thumbnail in all three; after it, all three updatecargo check --locked -p session-view --examples: pass; clippy onopencode-kitandsession-view: no new warnings;scripts/guardrails.sh: 11/11