feat!: upgrade llama.cpp to b10870, and unbreak the CI pipeline (WebUI embed, clang-format, REUSE) - #422
Conversation
…t.cpp The file added in #421 went in without either, so main is currently red on two gates that the PR run reported but the merge did not wait for: * clang-format (pinned 22.1.8) rejected the `(size_t) 1` cast spacing in the n_devices loops -- the repo style is `(size_t)1`. * REUSE found no copyright/licensing information. Every other file under src/test/cpp carries the SPDX header pair; this one did not. The patch file from the same change is fine -- REUSE.toml's `llama/patches/**` glob covers it, because a unified diff cannot carry an inline header without corrupting the diff. Both are mine and neither was caught locally, because clang-format and REUSE run only in CI. Verified after the fix with the same tools CI uses: `clang-format --dry-run --Werror` over src/main/cpp and src/test/cpp is silent, and `reuse lint` reports 455/455 files with both copyright and license information. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AnNYn8W1xuVxVJtyL34GyH
No project-source change. The four pin sites move together (llama/CMakeLists.txt GIT_TAG, README badge + link, CLAUDE.md, LlamaCppVersion.LLAMA_CPP_VERSION), so NativeLibraryLoadSmokeTest's pin-vs-linked-binary assertion stays satisfied. The headline diff number is misleading: common/chat.cpp loses 2524 lines, but that is a pure internal reorganisation splitting the per-model chat parsers into a new common/parsers/ directory. common/chat.h -- which jllama.cpp includes directly and which is #2 on the priority review list -- is byte-identical in the range, so nothing the project compiles against moved. The patch intersection was NOT empty, and 0012 was the patch at risk: the range touches src/llama-model.cpp and tests/CMakeLists.txt, both of which 0012 modifies, one week after it landed. The check CLAUDE.md mandates was run by hand first, because the fail-loud applier detects "does not apply" but never "upstream already fixed this": b10870:src/llama-model.cpp still carries the bare `splits[i] /= split_sum` with no zero-sum guard, so the patch stays rather than being dropped. Upstream's own change to that file (#28160, resolving lazy-mode AUTO to OFF where mmap is unsupported) sits ~60 lines above the patched region and is unrelated. Two behaviour changes that a header diff cannot see, both reaching every entry point that parses argv: * --mmproj-device now defaults to --device instead of auto-selecting, so a caller setting --device but not -mmdev now pins the multimodal projector to the same device. * the draft model inherits the global device list the same way, and common_speculative_init only overwrites result.devices when the spec list is non-empty (it previously assigned unconditionally), plus forces LLAMA_SPLIT_MODE_LAYER for a single-device draft. That is the path LlamaModelTest#testSpeculativeDecoding drives -- the same test that was red on macOS before patches/0012, so a failure there now needs attributing carefully between the two. ggml.h gains precision enum values and two functions, and deprecates ggml_mul_mat_set_prec / ggml_flash_attn_ext_set_prec; the project source has zero references to any of it. Verified: applier clean on a fresh build dir with all nine patch hashes stamped at head 1945e092 (= b10870); server contract byte-identical in all three mechanical dimensions (request fields, set_hard_limits bounds, response keys in both emit forms); ctest 527/527; mvn clean verify green (1742 tests, 0 failures, 0 errors); bytecode gate clean (616 classes / 5 jars, 0 over major 52). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AnNYn8W1xuVxVJtyL34GyH
Review Summary ✅This PR is a well-executed llama.cpp version bump with excellent upstream verification and CI compliance restoration. No issues identified. Key Strengths:
Observations:
Security & Quality: No vulnerabilities, no risky patterns, pure maintenance work. Status: Ready to merge ✅ |
|
One correction to the automated review's "Ready to merge ✅", because acting on it now would cost exactly what this PR is for. The That matters here more than usual. Merging while the start gate is still open cancels the run — which is precisely what happened to #421 twenty minutes ago: its entire pipeline went to Current state
The two red GPG checks are not this PR'sBoth preflights declare What to watch when the gate releases
Generated by Claude Code |
|
What failsThe npm/Svelte build succeeds; the next step dies — Why it is not this PR's
Confirmed against the base branch rather than reasoned about: run 34170576764 (#913, Why it matters more than it looksEvery native build job declares Proposed fixUpstream ships the replacement as a standalone, npm-free add_custom_target(llama-ui-assets ALL
COMMAND ${CMAKE_COMMAND}
"-DUI_SOURCE_DIR=..." "-DUI_BINARY_DIR=..." "-DLLAMA_SOURCE_DIR=..."
"-DHF_BUCKET=..." "-DHF_VERSION=..." "-DHF_ENABLED=..." "-DBUILD_UI=..."
"-DLLAMA_UI_GZIP=${LLAMA_UI_GZIP}"
-P "${PROJECT_SOURCE_DIR}/scripts/ui-assets.cmake")So the workflow step can invoke that same script and copy the generated Not pushed here: it is a Lesson worth recording
Generated by Claude Code |
The `Build WebUI assets (shared)` job has been failing since #420 with cc1plus: fatal error: embed.cpp: No such file or directory and every native build job declares `needs: build-webui`, so the whole matrix -- including `Java Tests macOS 15 arm64 (Metal)` -- was `skipped` behind it. That is why run 34170576764 (#913, main at b10850) produced no macOS result, and why patches/0012 has still never executed on Metal. Not caused by the b10870 bump: `tools/ui/` is byte-identical between b10850 and b10870 and `embed.cpp` exists at neither tag. Upstream c457e3bf7 ("ui : embed assets directly with CMake", #28445) deleted the host tool and replaced it with scripts/ui-assets.cmake plus ui.cpp.in / ui.h.in templates -- present at b10819, gone at b10850. The step now invokes that script directly. Priority 1 of its provisioning order is "pre-built assets in <UI_SOURCE_DIR>/dist", which is exactly what the npm step above produces, so BUILD_UI=OFF and HF_ENABLED=OFF keep it from running a second npm build or reaching Hugging Face. LLAMA_UI_GZIP is upstream's own knob and replaces the hand-rolled gzip loop. The sparse checkout gains `scripts` alongside `tools/ui`, and generation goes to RUNNER_TEMP so only ui.cpp/ui.h are copied into the artifact, as before. The completeness guard had to change too, and this is the part worth reading. A bare `grep LLAMA_UI_HAS_ASSETS` -- inherited from the old step -- silently PASSES the failure case now: ui.h.in emits "/* #undef LLAMA_UI_HAS_ASSETS */" for an empty table, so the token is present either way. embed.cpp emitted no such line, which is why the naive grep used to be sufficient. Verified, not assumed: with dist/index.html removed the old guard exited 0 and reported "real WebUI embedded" while ui.cpp shrank from 3862 to 694 bytes. The guard now asserts the ACTIVE #define plus a non-zero count parsed from `std::array<llama_ui_asset, N>`. Verified by running the step itself, extracted verbatim from publish.yml and executed in a simulated CI layout against a real b10870 tools/ui + scripts checkout: good path exits 0 with "8 assets embedded"; the empty-dist path exits 1 with "empty asset table (assets=0)". The generated ui.cpp/ui.h compile standalone and expose the same interface as src/main/cpp/webui_stub/ui.h (same struct, same three functions), so they stay a drop-in for the stub. Docs corrected in the same commit: CLAUDE.md's WebUI section and local recipe described the deleted embed.cpp, and the stub's header comment named it as the generator. webui_stub/ui.h is outside the clang-format CI glob (*.cpp/*.hpp only), so its pre-existing formatting is left untouched. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AnNYn8W1xuVxVJtyL34GyH
|
Updating my previous comment: the WebUI fix is pushed here now ( The step now runs upstream's One finding worth flagging: the old guard passed the failure caseThe step's completeness check was /* #undef LLAMA_UI_HAS_ASSETS */for an empty table — the token is present either way. The old Falsified rather than reasoned about — with
The guard now asserts the active How this was verifiedNot by reading the script — by running it. The
Also corrected in the same commit: Generated by Claude Code |
Code Review: PR #422 - llama.cpp b10850 → b10870SummaryThis PR successfully upgrades llama.cpp and resolves three CI failures (clang-format, REUSE compliance, and the WebUI build step regression). The work is thorough and well-documented. ✅ Strengths
|
|



Summary
src/llama-model.cppandtests/CMakeLists.txt, both modified bypatches/0012, one week after it landed — so this could not be waved through on a disjoint file list.mainright now, both from the#421merge and both mine:clang-format(cast spacing) andREUSE(missing SPDX header ontest_model_split.cpp). The PR run reported them; the merge did not wait.#421never got. Its wholepublish.ymlrun was cancelled in the start-gate abort window when the PR was merged, soJava Tests macOS 15 arm64 (Metal)— the only thing that can exercise thepatches/0012failing path — never executed. It runs here.Why
mainis red, and why it was invisible locallyclang-formatandREUSErun only in CI, so a full local gate chain (build, ctest,mvn verify, bytecode) passes without touching either. Both failures are one file:(size_t) 1in then_devicesloops; repo style is(size_t)1src/test/cppfile has the SPDX pairThe patch file from the same change is fine:
REUSE.toml'sllama/patches/**glob covers it, because a unified diff cannot carry an inline header without corrupting the diff.Both verified after the fix with the tools CI uses —
clang-format --dry-run --Werrorsilent,reuse lintat 455/455 files.The
0012question, answered by hand before the applierCLAUDE.mdrequires this explicitly, because the fail-loud applier detects "does not apply" but never "upstream already fixed this":Upstream has not adopted the fix, so
0012stays. Upstream's own change to that file (#28160 — resolvingLLAMA_LAZY_MODE_AUTOtoOFFwhere mmap is unsupported) sits ~60 lines above the patched region and is unrelated.What actually changed upstream
The headline number misleads:
common/chat.cpploses 2524 lines, but that is a pure internal reorganisation splitting per-model chat parsers into a newcommon/parsers/directory.common/chat.his byte-identical in the range —jllama.cppincludes it directly and it is #2 on the priority review list — so nothing the project compiles against moved.Two behaviour changes a header diff cannot see, both reaching every entry point that parses argv:
--mmproj-devicenow defaults to--deviceinstead of auto-selecting. A caller setting--devicebut not-mmdevnow pins the multimodal projector to the same device.common_speculative_initonly overwritesresult.deviceswhen the spec list is non-empty (it previously assigned unconditionally), plus forcesLLAMA_SPLIT_MODE_LAYERfor a single-device draft. That is the pathLlamaModelTest#testSpeculativeDecodingdrives — the same test that was red on macOS beforepatches/0012, so a failure there now needs attributing carefully between the two.ggml.hgains precision enum values plusggml_prec_set_acc/ggml_prec_set_src, and deprecatesggml_mul_mat_set_prec/ggml_flash_attn_ext_set_prec. The project source has zero references to any of it.Test plan
rm -rf llama/build)1945e092=b10870set_hard_limitsbounds, response keys in both emit forms)ctestreuse lintmvn clean verifyChunking: full diff 393 KB / 20 commits, over the runbook's 100 KiB threshold; review surface proper is 28 files, +2686 / −2480, of which ~2500 per side is the one mechanical parser move. Bumped straight on that basis, with the raw numbers recorded in the history table so the call is auditable.
What to watch on this run
Java Tests macOS 15 arm64 (Metal)is the one job that matters beyond the usual: it is the first execution of thepatches/0012path on real Metal hardware. Green there closes the verification gap the patch shipped with.Related issues / PRs
0012), whose CI never ran to completion.docs/history/llama-cpp-breaking-changes.mdcover the range and the patch verification.Checklist
CONTRIBUTING.mdandCODE_OF_CONDUCT.md🤖 Generated with Claude Code
https://claude.ai/code/session_01AnNYn8W1xuVxVJtyL34GyH
Generated by Claude Code