Skip to content

Studio: fix llama.cpp update banner offering a downgrade / sticking on mix releases - #6219

Merged
oobabooga merged 4 commits into
unslothai:mainfrom
oobabooga:fix-llama-update-banner-mix-tags
Jun 12, 2026
Merged

oobabooga merged 4 commits into
unslothai:mainfrom
oobabooga:fix-llama-update-banner-mix-tags

Conversation

@oobabooga

@oobabooga oobabooga commented Jun 12, 2026 •

Copy link
Copy Markdown
Member

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/latest returns the full tag_name, which for our mix builds is b9596-mix-<sha>. Detection used a plain string inequality (installed_tag != latest_tag), so:

  • on a mix release the two strings never match, even right after installing that exact release, so the banner sticks forever;
  • when /releases/latest lags behind the installed build (an older bNNNN), the inequality still fires and renders as a backwards arrow.

Detection also read /releases/latest while 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 b9596 and b9596-mix-e6f2453 both compare as 9596. Resolve "latest" the way the installer does (newest by published_at), not the lagging /releases/latest pointer.

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_tag the installer recorded and compares it to the newest published tag_name, and update_available is 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 a b9596-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

  • A bare bNNNN never supersedes a mix build at the same base (don't nag a mix install to "update" to the plain build).
  • Tags are stripped before comparison, so whitespace can't trigger a false update.
  • Non-bNNNN tags fall back to plain inequality.
  • The apply path (POST /update) reuses the same check, so a direct or stale-banner POST can't reinstall when not behind.
  • A successful update re-primes the freshness cache, so the banner can't linger on a stale value until the 24h TTL.

Verification

Reproduced the downgrade banner on a real install (marker b9585, stale cache b9518); 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.py 37, test_llama_cpp_update.py 38, test_llama_route.py 3, and 78 together.

@oobabooga
oobabooga requested a review from danielhanchen as a code owner June 12, 2026 00:05

@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 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

@oobabooga
oobabooga merged commit fb56b82 into unslothai:main Jun 12, 2026
24 of 27 checks passed
@danielhanchen

Copy link
Copy Markdown
Member

Thanks, this is the approach I want to carry forward. Confirmed against the current fork state: /releases/latest now points at b9596-mix-e6f2453, so the mix-tag handling here is necessary, and resolving "latest" by published_at instead of the /releases/latest pointer is the right call since that pointer lags behind the newest publish.

One parity check: the source-build detection path (_source_build_status in llama_cpp_update.py) resolves and compares on its own. If it does not already route through parse_base_build / is_behind, it is worth gating it the same way so a self-compiled install gets the identical strict build-number comparison. The prebuilt/marker path looks fully covered.

The failing Core and Repo tests (CPU) here are the unrelated rope_parameters strict-dataclass breakage on main (tests/utils/test_rope_scaling_drift.py), not anything in this PR, so they should not block it once main is sorted out.

Closing my own #6215 in favor of this.

danielhanchen pushed a commit that referenced this pull request Aug 30, 2026
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.
danielhanchen added a commit that referenced this pull request Aug 31, 2026
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.
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.

[Bug] New llama.cpp prebuilt error

2 participants