Repository navigation
release: v0.10.2 — cache write race fix - #24
Merged
Merged
Conversation
v0.10.1 introduced streaming background scans: the TUI opens on cached sessions immediately and stale agents stream their results in. `cache::write_cache` runs at TUI exit to persist the merged result. But if the user exits before a worker has reported in, `write_cache` would re-emit that agent with an empty session list and the current `mtime` of its data sources — making the cache look "fresh + empty" on the next launch and hiding the agent's sessions until a new file write changed the mtime again. Fix: pass the still-scanning agent set into `write_cache`. For each agent in that set, carry its prior cache entry (mtime + sessions) verbatim from the on-disk file, so an interrupted scan doesn't overwrite known-good cache state with `(now, [])`. Behavior of completed scans is unchanged.
Bumps version + CHANGELOG for the cache-write-race fix in this PR. Tag and release happen after merge.
3 tasks
2 tasks
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.
Summary
Ships v0.10.2 with the cache-write race fix introduced by v0.10.1's streaming TUI ingest.
The race
v0.10.1 made stale-agent scans run in the background and the TUI ingest results progressively.
cache::write_cacheruns at TUI exit to persist the merged result. But if the user exits before a worker has reported in,write_cachewould persist that agent as(empty session list, fresh mtime)— making it look "fresh + empty" on the next launch and hiding its sessions until file mtime changed again.What changed
cache::write_cachetakes a new&HashSet<Agent>of agents whose scan didn't finish in this run.main.rspassesapp.scanning_agents(the live set the TUI updates as workers report in) towrite_cache.Cargo.tomlto 0.10.2 + CHANGELOG entry.Why ship 0.10.2 instead of patching 0.10.1
The race only matters when the user exits during a scan. With v0.10.1's head/tail cap making scans complete in <1s on most setups, it's rare in practice — but the fix is small and worth shipping promptly since the race CAN cause a temporarily empty agent. Tag for v0.10.1 is already pushed and on crates.io; force-pushing it would break consumers who already have it.
Test plan
cargo testcargo clippy --all-targets -- -D warningscargo fmt --checkagf, exit immediately during scan, reopen → previously-cached sessions still visiblehomebrew/agf.rbv0.10.2 sha256 update🤖 Generated with Claude Code