Skip to content

Studio: show what changed in llama.cpp updates - #10117

Merged
danielhanchen merged 10 commits into
unslothai:mainfrom
oobabooga:feat/llama-update-changelog
Sep 2, 2026
Merged

danielhanchen merged 10 commits into
unslothai:mainfrom
oobabooga:feat/llama-update-changelog

Conversation

@oobabooga

Copy link
Copy Markdown
Member

Summary

Add an expandable "Show what's new" section to Studio's llama.cpp update banner.

Studio reads the exact installed and target tags, fetches their release descriptions from unslothai/llama.cpp by default, and compares the bullet entries. These release descriptions are cumulative, so showing the target release alone would repeat older carried patches. The banner displays only entries added in the newer build.

Implementation

  • Add an authenticated GET /api/llama/update-changelog endpoint, fetched only when the section opens and kept separate from the update status poll.
  • Cache exact GitHub releases for 24 hours and failures for 60 seconds, with a cache-bypassing retry.
  • Match entries by PRs, issues, and textual references so rebases and patches migrated to an Unsloth carry PR are not reported again. Preserve safe GitHub links in the displayed summaries.
  • Fail closed when either release is unavailable instead of displaying the cumulative target body. The frontend covers loading, retry, empty, truncated, stale, and mismatched responses.
  • Share the desktop updater's release-note layout, including its 448 px width, 16 rem notes cap, responsive height floor, scrollbar, spacing, typography, links, and footer.

Screenshots

Desktop

pr-llama-update-changelog-desktop

Mobile

pr-llama-update-changelog-mobile

The captures use a real seven-item comparison between published llama.cpp releases, not placeholder release notes.

Verification

  • 71 focused backend tests, 187 release-note contract tests, and 18 frontend layout tests passed.
  • TypeScript type checking, the frontend production build, Ruff, and targeted Biome checks passed. Biome reports only the existing complexity warning on LlamaUpdateBanner.
  • Playwright passed 239 responsive layout and interaction checks with zero failures.
  • Live comparisons returned seven changes for a recent update and nine for an older update. The older comparison correctly excluded an already-carried DiffusionGemma patch after its migration to an Unsloth PR.

Scope

  • The changelog appears only for an available managed llama.cpp prebuilt update with both release identities available. Source builds, custom paths, local linked installs, and whisper.cpp updates are unchanged.
  • It compares only the installed and target release descriptions. It does not reconstruct intermediate release history.
  • Desktop app release-note behavior is unchanged. Its presentation constants are now shared with the llama.cpp panel.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-01T14:03:54.816249Z 4d58ded Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: e33cc5de40

ℹ️ 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".

Comment on lines +198 to +199
if identities & old_identities or identities & seen:
continue

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve distinct PRs that share a tracking issue

When two different change bullets link their own PRs but also reference the same tracking issue, the second bullet is discarded because any overlap between their identity sets is treated as proof that they are duplicates. For example, identities {pr:#1, issue:#99} and {pr:#2, issue:#99} intersect even though they represent separate changes, so the banner silently omits PR #2 and undercounts total_changes; shared secondary references should not override distinct primary PR identities.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Not changing this. I ran _identities over all 140 published release bodies in unslothai/llama.cpp: 195 identities, every one of them pr:, no issue: identity has ever been produced, and no two bullets within a release body share an identity.

The bodies are generated by .github/workflows/unsloth-prebuilt.yml in that repo, which emits one /pull/ link plus that same PR's commit URL per bullet and never an /issues/ link. The {pr:#1, issue:#99} / {pr:#2, issue:#99} overlap therefore has no input that produces it. Splitting identities into primary and secondary would add branching to the one hot path here for a shape the release format cannot emit.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 6cb6f0c919

ℹ️ 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".

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 35a1ddaa48

ℹ️ 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".

Most installs cannot be compared at all. Replaying all 139 published
unslothai/llama.cpp releases through the comparison, 8160 of the 9591
possible (installed -> target) pairs return None, because 85 of those
releases predate the itemised bullet body introduced in b9625-mix-2d6bd50.
Every one of those users opened the panel, was told "Could not compare
these releases.", and was offered a Retry that forces two uncached GitHub
lookups and can never succeed.

Separate the permanent case from the recoverable one. The backend now
reports notes_not_itemised when the installed release predates the bullet
format, and the panel renders that as a plain statement with no Retry.
Only the installed side can be permanently uncomparable: a target without
a usable body is the newest release, so that stays recoverable and keeps
its Retry. The empty payload also carries release_url now, so a failed
comparison still offers a way to read the notes on GitHub, matching what
the desktop release-notes panel already does.

Also in the comparison:

- A missing or blank target body fails closed instead of reporting a
  successful comparison with zero changes. A prose-only target still
  means "this build carries nothing", which is a real statement.
- seen is updated only for bullets that are actually shown, so a bullet
  discarded for having no summary can no longer suppress a later real
  bullet citing the same PR.
- Pull URLs, issue URLs and textual repo#N refs share one ref: namespace.
  GitHub numbers issues and pull requests from the same sequence, so
  splitting them could only ever produce false negatives.
- _entry uses rfind for the " ([" metadata boundary. The generator always
  appends metadata last, and a PR title containing " ([" was truncating
  its own summary.

And around the fetch:

- A repo segment of only dots is rejected. "." is inside the repo
  character class, so "owner/.." passed the shape check and would walk
  out of /repos/ on any normalizing proxy.
- force_refresh is floored at one fetch per key per 30s, so holding down
  Retry no longer spends the user's GitHub quota two calls at a time.
- The success TTL uses a monotonic clock, and an entry past its TTL is no
  longer resurrected by a recent failure.
- The response read is capped at 4 MiB, and IncompleteRead is caught: it
  is an HTTPException, not an OSError, so a truncated response escaped to
  direct callers.

Frontend: the panel guard also checks changelogAvailable, so an install
that becomes a source build while the panel is open cannot leave it on
screen with no way to close it. External links go through openLink(),
since a bare target=_blank has nowhere to go in the Tauri webview. Link
keys include the index, because a bullet may cite the same URL twice.

Verified against the real release history: all 9591 pairs produce
byte-identical output before and after, so no live comparison changes.
The full studio backend suite reports the same 551 pre-existing
failures and errors with and without this change, and the focused suites
go from 74 to 86 passing. Frontend typecheck, build and 6248 tests pass;
ruff and the Python floor linter are clean, and the module still imports
and runs on 3.9 through 3.13.

@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: 2aefa0789f

ℹ️ 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".

Comment on lines +131 to +133
forced_at = _release_forced_at.get(key)
if forced_at is not None and now - forced_at < FORCE_REFRESH_MIN_INTERVAL_SECONDS:
force_refresh = False

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Coalesce concurrent forced release lookups

When two clients force-refresh the same uncached tag concurrently, the first records _release_forced_at before its network request finishes, while the second merely changes force_refresh to False; because neither the success nor failure memo exists yet, that second request still falls through to _fetch_release. Consequently, simultaneous retries or multiple open Studio tabs can each issue their own GitHub request despite the advertised rate floor, potentially exhausting the unauthenticated API limit; the suppressed caller should reuse or await the in-flight lookup rather than proceed on a cache miss.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Not changing this. The trace is right: on a cold key the second caller sets force_refresh = False, finds no memo and no failure entry, and falls through to _fetch_release. But the outcome is one duplicate GET per concurrent client, bounded by the number of open tabs, and both writers store the same body, so nothing is lost, truncated or misreported.

Coalescing means a per-key lock or condition held across a 5s network call on a request thread, which is a real hazard for a panel that is opened by hand. FORCE_REFRESH_MIN_INTERVAL_SECONDS is a floor on repeated retries from one client, which is the case that actually recurs, and it is not documented as a hard cap on concurrent callers.

Worth noting the floor is already the weaker constraint: at one forced fetch per key per 30s across the two keys, sustained clicking is 240 requests per hour against an unauthenticated budget of 60, with or without this race.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 1, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 1, 2026
@oobabooga

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@oobabooga

Copy link
Copy Markdown
Member Author

@codex review

@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: 490d3cd7f4

ℹ️ 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".

Comment on lines +416 to +420
result = changelog_for_update(
repo,
installed_full,
latest,
force_refresh = force_refresh,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Compare changes for the release macOS will install

On macOS systems where the newest prebuilt requires a newer OS, the update path deliberately leaves the release unpinned so the installer can walk back to an older compatible release, but this comparison always uses the newest freshness tag. The panel can therefore advertise carries present only in the incompatible release even though clicking Update installs an older build; resolve and compare the same compatible release selected by the macOS installer.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Not changing this here, but the underlying inconsistency is real and I do not want it lost.

The macOS walk-back is exactly as you describe (pin_release_tag = None if sys.platform == "darwin" else wanted_tag, with the comment saying a pin would disable it). But the target it can disagree with is not something this PR chose: _llama_only_status publishes latest_tag straight from check_prebuilt_freshness, which resolves the newest published release with no host-compatibility filter, and this PR touches neither llama_cpp_freshness.py nor freshness_flow.py nor _llama_only_status. So on such a host the banner headline already reads installed -> newest while Update installs an older build, on main today.

The changelog panel renders the same pair as the headline above it. Resolving the compatible release only inside the panel would make the card contradict itself while leaving the headline wrong, so the fix belongs in the status path, where both would pick it up. That is a separate change with its own macOS testing, not something to fold in here.

Flagging it rather than closing it: worth its own issue against the status resolution.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 7351624677

ℹ️ 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".

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 1, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 1, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 4d58deda1b

ℹ️ 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".

danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Sep 2, 2026
@danielhanchen

Copy link
Copy Markdown
Member

Captured before/after screenshots of what this PR changes on screen, from two isolated Studio installs: BEFORE is the PR's merge base 1d2679f4f, AFTER is head 4d58deda1. Each side gets its own install.sh --local, so each one serves a frontend actually built from that tree rather than one Studio with a checkout in between.

Both sides stub the same four update endpoints in the browser (api/llama/update-status, api/studio/update-status, api/studio/release-notes, api/llama/update-changelog) using the fixtures from this PR's own tests/studio/playwright_update_banner_layout.py. The stub is byte-identical on both sides, so the only thing that can differ is the built frontend.

Expanded

banner expanded

Collapsed

banner collapsed

Neither half is rescaled. The width difference you can see is this PR's own max-w-[400px] to max-w-[448px] change, sharing the desktop updater's width.

Numbers read from the same servers that were photographed:

fact BEFORE AFTER
toggle_present false true
panel_present false true
panel_state none ready
change_rows 0 3
changelog_requests 0 1

changelog_requests is the one worth noting: the route is registered on both sides, and BEFORE never requests it, because the endpoint does not exist on that build and nothing can open the panel. The single request on AFTER also confirms the panel fetches on open rather than on the status poll.

On the red CI

None of the five failing checks are caused by this PR:

  • (Python 3.13) and Repo tests (CPU) fail identically on plain origin/main without this PR. I ran test_non_gguf_reload_settings.py::...test_the_non_gguf_status_branch_publishes_them and test_model_picker_contracts.py::test_a_pinned_cached_row_loads_from_the_id_the_backend_pinned on a clean origin/main worktree and on main merged with this PR head, and both fail the same way in both. Pre-existing on main.
  • startup macos-15 and Chat UI, API, Update and GGUF inference are cancelled, not failed, superseded after 2h25m by the push of 4d58deda1.
  • pre-commit.ci reports 1015 files reformatted and then a conflict occurred when applying fixes to the pr, so its autofix push was skipped and it stayed red. Running the exact hook (pre-commit run ruff-format-with-kwargs --all-files, pinned ruff==0.6.9, clean environment) on main merged with this head passes with zero files changed, and none of this PR's files are implicated.

I also re-reviewed the four commits pushed after 2aefa0789. The non-cumulative-repo gate cannot disable the default repo, since CUMULATIVE_NOTES_REPO and DEFAULT_PUBLISHED_REPO are the same literal and repo still comes from the on-disk marker. I checked the new installed_tag / latest_tag query parameters specifically, since they are a new caller-controlled input feeding a GitHub API URL: the repo is still not caller-supplied and the tag is quote(..., safe="")-encoded, so ../../../../orgs/evil, https://evil.example.com/x, b1?client_id=1, b1#f and a CRLF payload all stay inside .../repos/unslothai/llama.cpp/releases/tags/ with every separator escaped. No path escape and no header injection.

One observation below the bar, no change requested: _release_memo and _release_forced_at are keyed (repo, tag), so an authenticated caller varying latest_tag by hand can step around the per-key FORCE_REFRESH_MIN_INTERVAL_SECONDS floor and grow the memos. The frontend only ever sends the pair it is displaying, so this is not reachable in normal use.

@danielhanchen

Copy link
Copy Markdown
Member

Cross-platform result, run on a staging repo so it does not sit in the org queue. Each leg installs and runs this PR's own suites (test_llama_cpp_changelog.py, test_llama_cpp_update.py, test_llama_route.py, tests/studio/test_update_release_notes.py) against fresh upstream main merged with head 4d58deda1:

runner result
ubuntu-latest success
macos-15 success
windows-latest 281 passed, 1 failed

The single Windows failure is test_a_second_spawn_during_the_update_does_not_overwrite_the_installer_argv, which asserts the ps lookup did not complete because _pid_identity(1664) returned None. That is the installer-spawn test doing a Windows process lookup, unrelated to the changelog, and every changelog test passed on all three runners.

Two other staging jobs went red for infrastructure reasons rather than code: the Playwright leg failed in apt-get install ffmpeg with a 404 from an Ubuntu mirror on all three retries, and Frontend build + bundle sanity failed with 21 unit tests from tests/edit-reply-keeps-tool-order.test.ts. That file does not exist on this branch, and it fails the same way on a clean origin/main worktree with this PR nowhere in the picture, so it is main's, not yours.

@danielhanchen
danielhanchen merged commit 5e774c2 into unslothai:main Sep 2, 2026
51 of 56 checks passed
danielhanchen added a commit that referenced this pull request Sep 6, 2026
Every one of these let a broken input pass the very test that exists to
catch it, reproduced before and after.

The empty-list matcher compared an unordered pair, so `0 < jobKeys.length`
(unmounts the panel exactly when there ARE jobs) and the always-true
`0 <= jobKeys.length` both satisfied it. The accepted shapes are now
spelled out with their operands in order.

The floor scan only knew `min-h-[calc(`, so an ungated `min-h-52`,
`min-h-[204px]` or `min-h-full` produced no literals and the component
returned unchecked, taking the `grow` assertion with it. It now reads any
`min-h-` token except `min-h-0`, which is the opposite of a floor. A
`getText()` keeps its quotes, so the token boundary has to strip them or
the start anchor never matches. An inline `minHeight` cannot be gated by
a class and is rejected outright.

The gate accepted a predicate that rendered any element at all.
`changelogAvailable` renders the changelog toggle and is true while the
panel is still closed, so a floor gated on it reserves the panel's height
on every collapsed card, which is #10117 exactly. The predicate must now
render the notes or changelog panel itself.

The rail enumeration read only literal children of an anchored div, so a
card reaching the Tauri rail through {children} was invisible. Nothing is
missed today, since those three are also listed in the browser rail, but
a desktop-only card would be, and a suite that under-covers silently is
the failure this file exists to prevent. It now also collects every
`positioned={false}` call site.

The browser probe treated only `position: static` as in flow. `relative`
and `sticky` still take part in normal layout, so a card that added
`relative` to anchor a control would drop out of the per-card dead-space
check and out of the download card count. Only `absolute` and `fixed` are
out of flow; all three call sites in that file now say so.
danielhanchen added a commit that referenced this pull request Sep 6, 2026
Two regressions in the bottom-right overlay rail shipped to main and had to be
undone by hand. Neither failed a test on the way in.

#9849 dropped `jobKeys.length === 0` from the Downloads panel's early return, so
a fresh install carried a download FAB on the corner with nothing behind it.
Reverted by #10298. #10117 copied the desktop updater's min-h floor onto the
llama.cpp banner while making its changelog render only once opened, so the card
reserved 204.2px and painted 147.3px and the stack sat 64.9px off the corner.
Fixed by #10229.

Both suites ran on #10117 and both passed. No fixture produced the empty-notes
state; every geometric check read the outer slot, which is the element carrying
the floor; and the source suite was edited in the same commit to assert the
floor was present, turning the bug into a pinned contract.

Adds two fast node tests that run on every frontend PR on ubuntu and windows,
inside the existing npm test step, for about a second between them:

- download-panel-not-permanent.test.ts matches the guard through the AST and
  evaluates the whole condition three-valued with the empty test pinned true, so
  an inverted or partial guard cannot satisfy it.
- overlay-rail-floor-gating.test.ts enumerates the rail's children out of
  provider.tsx and applies a rule rather than a spelling: a floor may only be
  reserved when the thing it protects is on screen. Both gates resolve against
  the components that actually render the shared notes layout root.

In the browser suite the dead-space probe now runs over every flowed card
instead of two named banners, the corner is measured off the bottom-most painted
surface rather than the rail's padding box, and the Downloads overlay is checked
absent by exact card count. Both rails carry a data-testid so the probe can find
the rail when no banner is up.

Every check was verified to fail at the commits that shipped the bugs, and seven
mutations across two review rounds are confirmed caught.
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.

2 participants