Repository navigation
Studio: never offer an older llama.cpp prebuilt as an update - #6215
danielhanchen wants to merge 3 commits into
Conversation
The in-app update banner offered an OLDER build than installed (e.g. b9585 -> b9518) and reappeared even after clicking Update. Two causes: - get_update_status gated update_available on installed_tag != latest_tag, which fires when latest is older than installed (a stale 24h release cache, or the host resolver walking back to an older partial release). - After a successful apply, reset_caches left the on-disk release cache and the markerless resolver memo intact, so the next poll re-derived the same stale older latest and re-showed the banner. Gate update_available on a strict build-number compare (latest must be strictly newer than installed) in both the marker and source-build paths, and after a successful apply drop the disk release cache and resolver memo.
There was a problem hiding this comment.
Code Review
This pull request improves the update status logic for llama.cpp to prevent downgrades when dealing with stale caches or older partial releases. It introduces a helper function _tag_build_number to parse build numbers from release tags, updates update-checking logic to strictly require a newer build number, and clears on-disk caches and resolver memos upon a successful update. Additionally, comprehensive tests have been added to verify these behaviors. Feedback suggests refining the regular expression in _tag_build_number to specifically match tags starting with 'b' (e.g., b(\d+)) to avoid false positives on other numeric sequences.
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.
| m = re.search(r"(\d+)", tag) | ||
| return int(m.group(1)) if m else None |
There was a problem hiding this comment.
Using r"b(\d+)" ensures we only extract the build number from tags starting with b (e.g., b9585), matching the docstring's description. This prevents false positives on other digits that might appear in non-standard tags, such as version numbers (e.g., v1.0 matching 1) or CUDA runtime suffixes (e.g., cuda13 matching 13).
| m = re.search(r"(\d+)", tag) | |
| return int(m.group(1)) if m else None | |
| m = re.search(r"b(\d+)", tag) | |
| return int(m.group(1)) if m else None |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 98984c761b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| installed_build = _tag_build_number(installed) | ||
| latest_build = _tag_build_number(latest) | ||
| # Offer only a STRICTLY newer build. A stale release cache (latest behind the | ||
| # freshly installed marker) or an older partial release must never downgrade. | ||
| update_available = bool( | ||
| freshness.get("has_marker") and installed and latest and installed != latest | ||
| freshness.get("has_marker") | ||
| and installed_build is not None | ||
| and latest_build is not None | ||
| and latest_build > installed_build |
There was a problem hiding this comment.
Compare marker installs against upstream build tags
For installs from the default unslothai/llama.cpp published repo, the marker's tag is the upstream llama.cpp build such as b9457, but the GitHub release returned here can be the fork wrapper tag such as v1.0 (the source-build path explicitly handles this by using llama_tag). In that scenario, a newer fork release like v1.1 carrying upstream b9585 is parsed as build 1, so latest_build > installed_build is false and the in-app update is suppressed for users who are actually behind.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Checked this against the published repo. On the marker path latest_tag comes from the GitHub releases API tag_name, and for unslothai/llama.cpp that tag is the upstream build itself (the /releases/latest endpoint returns b9585 today, and every recent release is bNNNN). There is no separate wrapper release carrying a hidden build number on this path, so _tag_build_number parses it correctly.
The source-build path is the one that can see a fork wrapper tag, and it already resolves against llama_tag (the bNNNN that --version reports), not release_tag, so a v1.x wrapper never reaches the comparison there either.
The only non-bNNNN tags the fork has ever published are the old llama-prebuilt-master-* date tags, which parse to None and fail open (offer nothing). That is the intended direction for this fix: never present something we cannot prove is strictly newer, which is exactly how b9585 -> b9518 slipped through before. So I am keeping the strict gate as is.
Match b(\d+) instead of the first digit run so wrapper/date tags and master-style asset names (e.g. llama-prebuilt-master-ac76808) fail open to no-update rather than comparing a stray number.
|
Good call. Anchored the parser on the b prefix ( |
|
Closing in favor of #6219, which supersedes this. After the mix-tag releases went live ( |
Summary
The in-app "New llama.cpp version" banner could offer an OLDER build than the one installed, and it reappeared even after clicking Update. Reported cases:
b9585 -> b9518andb9596 -> b9594, where the offered tag is lower than the installed one (which is also GitHub's latest).Root causes:
get_update_statusgatedupdate_availableoninstalled_tag != latest_tag, a plain inequality that fires wheneverlatestdiffers from installed, including whenlatestis older. The source-build path additionally treated an unknown installed version as "behind" without checking that the candidate parsed to a newer build.latestcan legitimately resolve to an older tag. The 24h release cache can still hold the previous GitHub latest while the marker on disk is freshly newer, and the per-host resolver can walk back to an older partial release for the preferred CUDA runtime line (several recent releases ship only the cuda13 Linux line).reset_cachescleared only the in-memory caches, leaving the on-disk release cache and the markerless resolver memo intact, so the next poll re-derived the same stale "latest" and the banner reappeared.Fix
update_availableon a strict build-number comparison (latest_build > installed_build) in both the marker and source-build paths, via a shared_tag_build_numberhelper. An older or stale "latest" can no longer be presented as an update, regardless of which path produced it.reset_caches(drop_disk=True)) and the resolver memo so the banner cannot reappear off stale data.Test plan
test_llama_cpp_update.pyandtest_llama_cpp_freshness.py: stale-cache downgrade suppressed (marker path), older-resolver-tag downgrade suppressed (source-build path), unknown installed version still offered only when the candidate parses, apply clears the resolver memo, anddrop_diskremoves the on-disk cache.