Repository navigation
Studio: fix llama.cpp update banner offering a downgrade / sticking on mix releases - #6219
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the update-checking logic for llama.cpp prebuilts to prevent false update or downgrade notifications. It introduces parse_base_build and is_behind helper functions to handle complex release tag comparisons (such as mix builds) and updates the freshness checks to utilize this new logic. The feedback suggests adding dedicated unit tests for these new helper functions to ensure their robust behavior and prevent future regressions.
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.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2ce40bbd15
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Thanks, this is the approach I want to carry forward. Confirmed against the current fork state: One parity check: the source-build detection path ( The failing Closing my own #6215 in favor of this. |
Two defects in the pre-flight added by the previous commit. It probed the download host's latest pointer while the install passes --published-release-tag from the phase. That pointer sorts by commit date and can lag the published_at pick the freshness check used, which is the #6219 class the phase pins against, so the pre-flight could clear one release and install a different one. It now passes the phase's repo and pinned tag, so it evaluates the artifact that would actually be installed. It also treated every negative answer as a pairing gap. The resolver maps an unreachable API, an unreadable manifest and an unsupported platform to exit 0 with prebuilt_available=false, so the exception fallback was unreachable for that whole class and an update could be skipped over a network blip, reported as a pairing gap that was never established. The install path already draws the line the pre-flight needs: ReleaseCompatibilityError is exit 2, a valid release this runtime cannot pair, and every other failure is exit 1. The resolver flattened both into a bare prebuilt_available=false. It now reports unavailable_reason, incompatible or unresolved, and the pre-flight skips only on incompatible. Anything else, including a resolver that never ran, falls through to the install.
chained_phase_plan waives its pairing gate when the llama phase runs first, on the grounds that the new llama supplies a workable pairing. That holds only while a whisper release exists for the llama build being installed, and for ten days it did not: llama shipped b10639, b10672, b10679 and b10687 while the newest whisper bundle stayed pinned to b10472-mix-4b653db. The whisper phase then ran an install that could not succeed, the installer exited 2, and a llama update that had already landed was reported as a failed job. Make the check the plan deferred, once the new llama is in place. A pairing gap becomes the same clean skip the plan itself would have produced, with skip_reason paired_llama_unavailable, so the outcome does not depend on which order the phases were planned in. The pre-flight probes the exact release that would be installed, passing the phase's repo and pinned tag rather than the download host's latest pointer, which sorts by commit date and can lag the published_at pick (#6219). It skips only on a positive incompatibility: the resolver now reports unavailable_reason, mirroring the split the install path already makes between exit 2 and exit 1, so an unreachable API or an unreadable manifest falls through to the install instead of reading as a confirmed pairing gap. It probes the target release unconditionally rather than testing the installed marker, since a fat marker omits install_kind by design and releases are slim-only now. This narrows when exit 2 happens; it does not swallow it. An attempt that goes ahead and turns out incompatible still surfaces as a job error, which is what keeps an incompatible release actionable instead of a false success. run_chained_update also honours a skip reported from a phase result, so the breakdown names a reason whether the decision was reached at planning time or after the earlier phases ran.
The "New llama.cpp prebuilt" banner offered a downgrade (
b9596 -> b9594) and kept reappearing after a successful update. Reported on Reddit: https://www.reddit.com/r/unsloth/comments/1u34fa3/new_llamacpp_prebuilt_b9596_b9594/Closes #6213
Problem
The banner compared two tags that are written in different formats. The install marker records a normalized base
tag(b9596), but GitHub/releases/latestreturns the fulltag_name, which for our mix builds isb9596-mix-<sha>. Detection used a plain string inequality (installed_tag != latest_tag), so:/releases/latestlags behind the installed build (an olderbNNNN), the inequality still fires and renders as a backwards arrow.Detection also read
/releases/latestwhile the installer resolves "latest" by publish time, so the two didn't even agree on what "latest" is.Fix
Compare the full tag on both sides, and decide "is there an update" by build number instead of by string difference. Read the build number out of the start of the tag, so
b9596andb9596-mix-e6f2453both compare as 9596. Resolve "latest" the way the installer does (newest bypublished_at), not the lagging/releases/latestpointer.The rule, by example (installed -> latest):
b9596-mix-e6f2453->b9596-mix-e6f2453: same tag, no update (this is what was sticking).b9596->b9594: latest is older, no update (this was the downgrade arrow).b9500->b9596-mix-e6f2453: higher build, offer the update.b9596-mix-aaa->b9596-mix-bbb: same build, different mix, offer it.Concretely: detection now reads the full
release_tagthe installer recorded and compares it to the newest publishedtag_name, andupdate_availableis true only when the latest build is actually newer (not just a different string).Comparison to #6214
#6214 parses tags with a strict full match (
re.fullmatch(r"b(\d+)")), which returns nothing for ab9596-mix-<sha>tag and falls back to the old string inequality. So on mix releases (the current/releases/latest):b9596-mix-e6f2453->b9596-mix-e6f2453: still reports an update, banner keeps sticking.b9596->b9594-mix-xxx: reports an update, i.e. offers an actual downgrade.This PR reads the base from the start of the tag (so mix tags parse) and compares the full
release_tag.Hardenings
bNNNNnever supersedes a mix build at the same base (don't nag a mix install to "update" to the plain build).bNNNNtags fall back to plain inequality.POST /update) reuses the same check, so a direct or stale-banner POST can't reinstall when not behind.Verification
Reproduced the downgrade banner on a real install (marker
b9585, stale cacheb9518); gone after the fix. Added regression tests for the tag comparison (is_behind/parse_base_build), the mix-sticky and downgrade cases through detection, the publish-time resolver, and the apply-path guard. Suites pass:test_llama_cpp_freshness.py37,test_llama_cpp_update.py38,test_llama_route.py3, and 78 together.