Skip to content

release: v0.10.2 — cache write race fix - #24

Merged
subinium merged 2 commits into
mainfrom
fix/cache-write-race
Apr 25, 2026
Merged

subinium merged 2 commits into
mainfrom
fix/cache-write-race

Conversation

@subinium

@subinium subinium commented Apr 25, 2026 •

Copy link
Copy Markdown
Owner

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_cache runs at TUI exit to persist the merged result. But if the user exits before a worker has reported in, write_cache would 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_cache takes a new &HashSet<Agent> of agents whose scan didn't finish in this run.
  • For each in-flight agent, the function loads the existing on-disk cache and carries that entry verbatim (mtime + sessions) into the new file — so completed scans persist while interrupted ones are left untouched.
  • main.rs passes app.scanning_agents (the live set the TUI updates as workers report in) to write_cache.
  • Bump Cargo.toml to 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 test
  • cargo clippy --all-targets -- -D warnings
  • cargo fmt --check
  • Manual: open agf, exit immediately during scan, reopen → previously-cached sessions still visible
  • After merge: tag v0.10.2 + push → release.yml builds artifacts; auto-publish to crates.io (CARGO_REGISTRY_TOKEN secret added)
  • Follow-up PR for homebrew/agf.rb v0.10.2 sha256 update

🤖 Generated with Claude Code

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.
@subinium subinium changed the title fix(cache): preserve prior cache for in-flight agents on TUI exit release: v0.10.2 — cache write race fix Apr 25, 2026
@subinium
subinium merged commit aa37786 into main Apr 25, 2026
5 checks passed
@subinium
subinium deleted the fix/cache-write-race branch April 25, 2026 00:55
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