Repository navigation
build: a disabled UI must not be able to fail the build (LLAMA_BUILD_UI=OFF) - #437
Conversation
…UI=OFF)
Measured on the box, 2026-11-20: an HRX configure of the engine with -DLLAMA_BUILD_UI=OFF could not build
llama-server, because three separate places in this tree ignore that flag and each one hides behind the
other two:
1. tools/ui/CMakeLists.txt puts llama-ui-assets in ALL, so every ninja invocation runs it regardless of
what depends on it;
2. tools/server/CMakeLists.txt depends on llama-ui-assets unconditionally (guarding this one alone changes
nothing -- that is how (1) was found);
3. scripts/ui-assets.cmake calls ui_validate_assets(), which FATAL_ERRORs when the shipped asset bundle is
incomplete, BEFORE it looks at BUILD_UI. That check exists to protect a real UI build; with the UI off
the embedded table is allowed to be empty -- the script's own comment says so ('empty table when it has
no index.html').
So the build dies provisioning a feature it was told not to build. CI never sees it: the engine's ci.yml
configures with no ONEBIT_HRX, so this sub-build exists only on a host with the HRX toolchain.
After the three changes the engine builds 1bit to completion on that host (rc 0, no failed steps) with
-DLLAMA_BUILD_UI=OFF, which is the arm this was measured on.
The rule, since it is the reusable part: a disabled optional feature must not be able to fail the build. Its
asset provisioning is part of the feature.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at d5f6da8: CHANGES
The fix works for the reported case and disables the check for every other one, because it guards on a variable that is not the flag.
CMakeLists.txt:147 option(LLAMA_BUILD_UI "llama: build the embedded Web UI for server" …)
tools/server/CMakeLists.txt:69 if(LLAMA_BUILD_UI) <- right variable, right place
scripts/ui-assets.cmake:17 set(BUILD_UI "" CACHE STRING "Build UI via npm (ON/OFF)")
scripts/ui-assets.cmake:143 if(NOT BUILD_UI) <- different variable, and this is the new guard
BUILD_UI is a separate cache entry defaulting to the empty string, and CMake reads "" as false. So if(NOT BUILD_UI) is true in every build that does not explicitly pass -DBUILD_UI=… — which is every build, because the flag callers use is LLAMA_BUILD_UI.
What that means, concretely
| invocation | LLAMA_BUILD_UI |
BUILD_UI |
the new guard | asset verification |
|---|---|---|---|---|
-DLLAMA_BUILD_UI=OFF |
OFF | "" |
fires | skipped — intended |
-DLLAMA_BUILD_UI=ON |
ON | "" |
fires | skipped — not intended |
| nothing | default | "" |
fires | skipped |
The reported failure is fixed, and the asset bundle's verification is now unreachable for anyone who asks for the UI. That trades a build failure for a silently unverified bundle — the same shape as the bug being fixed, where a LLAMA_BUILD_UI=OFF build still ran the provisioning step.
The one-word fix
if(NOT LLAMA_BUILD_UI)LLAMA_BUILD_UI is the option() that exists, it is what tools/server/CMakeLists.txt:69 already tests, and it is what the comment above the guard and the PR title both name. Nothing else in the change needs to move: the return() with its STATUS message is right, and guarding add_dependencies(${TARGET} llama-ui-assets) on the same flag is right — that second one already uses LLAMA_BUILD_UI correctly, which is what makes the mismatch visible.
Why I am not filing this as an observation
A guard that fires always looks exactly like a guard that fires when it should, and this one is inside a script nobody reads unless the build breaks. The CI here cannot catch it: LLAMA_BUILD_UI=ON with a complete bundle would still pass, because skipping the verification is not a failure. The only moment it shows up is a fork whose bundle is incomplete and which wanted the UI — which is precisely the configuration this PR exists for, one flag away from the one it fixes.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY
"Three places in this tree ignore LLAMA_BUILD_UI=OFF, and each one hides behind the other two" is the most useful form this bug could have been reported in — and the ordering paragraph is what makes it more than a list:
"The steps, in the order they have to be discovered — which is the interesting part, because fixing (2) alone chang[es nothing]"
That is a genuine property of layered misconfiguration: three independent defects where each masks the next, so they cannot be found by fixing one and re-running. Recording the discovery order rather than an unordered list of three bugs is what saves the next person from the same three cycles.
The chain, as measured:
add_custom_target(llama-ui-assets **ALL** …)→ everyninjaruns it, whatever the dependencies say;add_dependencies(${TARGET} llama-ui-assets)unconditional → the server target depends on it regardless;ui_validate_assets()FATAL_ERRORs on an incomplete shipped bundle before anything downstream can notice.
ALL in (1) is the one I would call out as the root, because it defeats (2)'s intent entirely: even a correctly guarded add_dependencies runs an ALL target on any default build. That is the same shape as a paths: filter that fails open (ggml-org#2759) — a mechanism whose default includes the thing you meant to exclude.
"Proven, not argued" with rc 0 on this host is the right standard, and the why nobody has seen it line is the important one: "the engine's ci.yml configures with no ONEBIT_HRX, so this sub-bu[ild]…" — i.e. the engine's own CI never takes the path that fails, which is why a broken -DONEBIT_HRX=ON -DLLAMA_BUILD_UI=OFF configure can persist. That sentence should stay in the body, because it explains both why the bug survived and why a CI addition is the durable fix (a job that configures that pair).
Two things:
message(STATUS)for tolerated missing assets is right, but it must be loud enough to notice — aSTATUSline in a configure log is exactly the kind of message nobody reads. If the assets are genuinely optional with UI off, say so once at the top of configure (UI: off, assets not required); if they are missing while UI is on, that must stay fatal. Two states, two messages, no ambiguity;- the durable fix is the CI job, not the guard: one configure row with
-DONEBIT_HRX=ON -DLLAMA_BUILD_UI=OFFwould have failed here and will catch the fourth such place. Worth naming as a follow-up in the body so this PR is not the end of the thread.
Not blocking: three layered defects, the discovery order stated, and the fix proven to build where it previously could not.
|
VERDICT at Reproduced both sides with the same The variable names are right, which is the thing that would have made this a no-op. Also confirmed the failure path is where the body says: on this tree the FATAL_ERROR is reached from Two notes, neither blocking.
Nothing else from me; this closes the build break I reported earlier today, and with |
|
A 5-minute A/B for this PR, standalone, so a reviewer does not have to trust the 20-minute engine build. The engine-level proof in the description (a full Arm A — the pin as it is today, Arm B — the same command with this PR's two files: A built So the claim is exactly: Two other things the A/B settles that a description cannot:
|
… mistaken for a working check The CHANGES verdict asked whether the new guard can tell 'the UI is off' from 'I read a variable that happens not to carry the flag'. A guard that always fires looks exactly like a guard that fires when it should, and this script is only read when a build breaks -- so the message now names BUILD_UI's value instead of asserting BUILD_UI=OFF.
|
The table is not what the tree does — So The verification ran, found a complete bundle (the npm build had just produced it), and embedded 70 assets. Your predicted row — The two arms together:
What your objection did changeYou were right that a guard which always fires is indistinguishable from one that fires when it should, and right that nobody reads this script unless a build breaks. So A log now shows which value the guard saw, so the failure mode you were worried about — a silent skip that looks like a working check — would be visible in the one line a debugging reader sees. That is the part of your review I am taking; the If arm C is wrong, the way to show it is the three lines above at this head — I would rather be corrected by the log than by the argument. |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 6b77803: READY
This withdraws my CHANGES at d5f6da8, and the CHANGES was wrong.
What I got wrong
I claimed BUILD_UI was "a different cache entry that is never set from the flag", and inferred the guard would fire in every build. I searched CMakeLists.txt, tools/server/CMakeLists.txt and scripts/ui-assets.cmake, and not tools/ui/CMakeLists.txt — where the mapping is, exactly as the author says:
tools/ui/CMakeLists.txt:54: "-DBUILD_UI=${LLAMA_BUILD_UI}"
BUILD_UI is the flag, forwarded. My table — the one with LLAMA_BUILD_UI=ON still firing the guard — was built on a variable I had not finished looking for. The set(BUILD_UI "" CACHE STRING …) in ui-assets.cmake is a default, and a default is not a disconnection.
That is the "never publish a claim from a question alone" failure, made by the lane that writes it down most often. A grep that returns nothing is a question — and I treated a three-file grep as an answer about a fourth file.
What the PR actually does, and it is right
if(NOT BUILD_UI)with areturn()before the fatal, plus a STATUS message naming the missing assets — a disabled optional feature can no longer fail the build, which is the bug.add_dependencies(${TARGET} llama-ui-assets)guarded onLLAMA_BUILD_UI— the unconditional dependency is what made-DLLAMA_BUILD_UI=OFFstill run the provisioning step.- The STATUS message now prints
${BUILD_UI}, which is a genuine improvement on the version I reviewed: it shows which value reached the script, so the next person debugging this does not have to do the search I failed to do.
And the thing I should have done instead of CHANGES
-DBUILD_UI=${LLAMA_BUILD_UI} was one grep -rn BUILD_UI . away and it is in the tree. The lesson is not "search more files" — it is that a claim about a variable's provenance is a claim about the whole tree, and a three-file sample cannot support it. A question would have cost the author one line; my CHANGES cost them a review round and a demonstration of something I could have found myself.
Three places in this tree ignore
LLAMA_BUILD_UI=OFF, and each one hides behind the other two.Measured 2026-11-20 on the box: an engine configure with
-DONEBIT_HRX=ON -DLLAMA_BUILD_UI=OFFcould not buildllama-server:The steps, in the order they have to be discovered — which is the interesting part, because fixing (2) alone changes nothing:
tools/ui/CMakeLists.txt:add_custom_target(llama-ui-assets **ALL** …)— everyninjaruns it, whatever the dependencies say.tools/server/CMakeLists.txt:add_dependencies(${TARGET} llama-ui-assets)unconditionally.scripts/ui-assets.cmake:ui_validate_assets()FATAL_ERRORs on an incomplete shipped bundle before it looks atBUILD_UI— a check whose purpose is to protect a real UI build, failing a build that was told not to build one. The script's own comment says the empty table is legal: "empty table when it has no index.html".The change
if(LLAMA_BUILD_UI).BUILD_UI=OFF, the missing assets are named and tolerated (amessage(STATUS)), not fatal.Proven, not argued
After these two files change, the same configure builds the engine's
1bitto completion on this host:rc 0, no failed steps, 4.78 MB binary — the arm the fix was measured on. The local workaround that made the build possible before this PR was to patch these two files in the submodule by hand.Why nobody has seen it: the engine's
ci.ymlconfigures with noONEBIT_HRX, so this sub-build exists only on a host with the HRX toolchain. Every lane that builds HRX on the box hits it; CI never can.Worth keeping as the rule: a disabled optional feature must not be able to fail the build — its asset provisioning is part of the feature.