Skip to content

Studio: drop the on-disk freshness cache after a llama.cpp update - #6234

Merged
danielhanchen merged 1 commit into
mainfrom
studio/fix-mix-stale-disk-cache
Jun 12, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
studio/fix-mix-stale-disk-cache

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

Follow-up to the mix-tag freshness work (#6219). The post-install/update path cleared only the in-memory freshness caches, then re-primed the 24h on-disk cache with a forced GitHub refresh. When that refresh cannot reach GitHub (offline, rate-limited), latest_published_release falls back to its last-good disk value. So a still-fresh same-base mix tag cached just before the swap (e.g. b9596-mix-aaa while the install just moved to b9596-mix-bbb) gets replayed, is_behind reads the prebuilt as behind, and a false update banner points back at the build that was just replaced.

Same-base mix-vs-mix tags have no defined ordering between their shas, so the freshness logic cannot disambiguate a stale cached "other" mix from a genuinely newer one. The right fix is to not compare a just-applied install against a value cached before it.

Change

  • reset_caches gains a keyword-only drop_disk = False. With drop_disk = True it also deletes the on-disk 24h release cache (a dedicated freshness-only subdir, re-created on the next write). The no-arg form stays in-memory only (its existing test-only contract).
  • The update path calls reset_caches(drop_disk = True). With the disk cache gone, an offline post-install refresh leaves latest as None, so check_prebuilt_freshness fails open (banner off) instead of lingering on the stale same-base value. When the refresh does reach GitHub, the disk cache is re-primed with the true newest exactly as before.

Test plan

studio/backend/tests/test_llama_cpp_freshness.py, all green (42 freshness + 38 update = 80):

  • drop_disk = True removes the on-disk cache; the no-arg form keeps it; drop_disk = True on a missing dir is a quiet no-op.
  • End-to-end: a still-fresh same-base mix on disk plus an offline refresh, after reset_caches(drop_disk = True), yields latest_tag = None and behind/stale = False (fails open).
  • Contrast guard: the same setup with an in-memory-only reset replays the stale mix and reads behind/stale = True, pinning the exact failure mode drop_disk removes.

The post-install path cleared only the in-memory freshness caches and then
re-primed the 24h disk cache with a forced GitHub refresh. When that refresh
cannot reach GitHub, latest_published_release falls back to the last-good disk
value, so a still-fresh same-base mix tag cached before the swap (b9596-mix-aaa
vs the just-installed b9596-mix-bbb) is replayed and the prebuilt reads as
behind, surfacing a false update banner that points back at the build that was
just replaced.

Give reset_caches a drop_disk option and use it on the update path: with the
disk cache gone, an offline post-install refresh leaves latest as None and the
banner fails open (off) instead of lingering on the stale same-base value. The
no-arg form stays in-memory only. Adds regression coverage for the drop, the
default no-op, and the fail-open vs stale-replay contrast.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the reset_caches function in llama_cpp_freshness.py to support an optional drop_disk parameter, which deletes the on-disk release cache when set to True. This parameter is utilized during the update process in llama_cpp_update.py to prevent stale cached values from being replayed if a subsequent network refresh fails, allowing the banner to fail open. Comprehensive unit tests have been added to verify these behaviors. There are no review comments, and I have no additional feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@danielhanchen
danielhanchen merged commit 6a0a62e into main Jun 12, 2026
1 of 31 checks passed
@danielhanchen
danielhanchen deleted the studio/fix-mix-stale-disk-cache branch June 12, 2026 09:43
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