Skip to content

lemond-onebit: the *-HRX rows ran upstream's hrx-b99 - point that recipe at the payload's own HRX backend - #3472

Merged
bong-water-water-bong merged 2 commits into
mainfrom
fix/3399-hrx-recipe
Nov 24, 2026
Merged

bong-water-water-bong merged 2 commits into
mainfrom
fix/3399-hrx-recipe

Conversation

@bong-water-water-bong

@bong-water-water-bong bong-water-water-bong commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

What was wrong

Lemonade's stock llamacpp-hrx recipe (upstream's, not our onebit recipe) is what all 29 *-HRX catalogue
rows name. Nothing in the release package pointed it at a local build, so lemond's BackendManager downloaded
llamacpp-hrx/hrx (version.txt = hrx-b99) on first use and ran that. On 1bit OS it registers no GPU —
issue #3399 measured llama-server --list-devices → Available devices: (none) under lemond's environment, and
a load failing with error while handling argument "--device": invalid device: HRX0 — so every -HRX row was
unloadable on the appliance (unaffected: the engine's own onebit route).

Mechanism, read from the pinned fork and the box:

  • The stock recipe's build_server_environment() adds only GGML_DISABLE_VULKAN to the child
    (third_party/lemonade/src/cpp/server/backends/hrx/hrx_server.cpp), and the running lemond's environment
    (measured on strixhalo, /proc/<lemond>/environ) carries the save-area trio + LD_LIBRARY_PATH but no
    IREE_HAL_AMDGPU_LIBHSA_PATH. That is the state scripts/hrx-env.sh:24-28 records as "the system ROCr,
    which with HSA_USE_SVM=0 registers no HRX0"
    (engine#674/hrx: gfxhub permission page faults (UTCL2 client CPF) on the rebuilt box with the TheRock nightly libhsa — the no-SVM env trio is the only fault-free arm #715) — so --list-devices prints (none) and the
    recipe's hardcoded --device HRX0 is rejected.
  • The payload already ships the pieces: an HRX llama-server built from our pins
    (1bit/hrx/llama/bin, scripts/package-linux.sh:59) and 1bit/lemonade-hrx, the shim that starts it in the
    environment 1bit serve --print-backend-env builds for an HRX backend (strict placement, TheRock HSA runtime,
    CWSR, trio; scripts/package-linux.sh:202).
  • The one place that should wire them is the launcher every appliance start goes through —
    os/v3/puppy/embed/etc/init.d/10lemonade → /opt/1bit-package/lemond-onebit — and it did not.

The change

  • scripts/lemond-onebit.sh: export LEMONADE_HRX_HRX_BIN to $here/1bit/lemonade-hrx unless the caller set
    it. Lemonade reads that name before hrx.hrx_bin in config.json
    (backend_utils.cpp:319-381, get_bin_config_value builds "LEMONADE_" + section + "_" + bin_key), and a
    path makes find_external_backend_binary return it before install_from_github's needs_install check
    (backend_utils.cpp:332-368, :540-548) — so the upstream download stops happening too. A caller's value wins,
    and LEMONADE_HRX_HRX_BIN=builtin is the documented opt-out back to Lemonade's own download.
  • tests/lemond_onebit.sh + ctest row lemond_onebit: runs the launcher over a fake payload whose
    bin/lemond records its environment and argv; asserts the new variable, the path it names, the argv, the
    caller-wins and builtin arms, and carries a control arm that rebuilds the pre-fix launcher and shows it hands
    lemond no variable. No build, no device, no engine.
  • os/mini/release-check.sh: a new hrx-recipe row reads the running lemond's environment
    (lemond_environ, the listener found by socket inode as lemond_key does) and FAILs when it names no payload
    backend, or a path that does not exist / is not executable; SKIPs when the image starts lemond without the
    package launcher, the catalogue offers no -HRX row, or the environment cannot be read. The verdict is a pure
    function and --self-test drives six cases, including the empty value that is the v2026.48 state.
  • docs/lemonade.md: the appliance/package wiring, next to the existing Ubuntu-PPA section.

Evidence — host side

$ ctest --test-dir build -R 'lemond_onebit|release_check_selftest' --output-on-failure
1/2 Test #45: lemond_onebit ....................   Passed    0.06 sec
2/2 Test #50: release_check_selftest ...........   Passed    0.66 sec
100% tests passed, 0 tests failed out of 2

Control — the same new test against origin/main's launcher (throwaway copy, new test file only), i.e. the
pre-fix tree:

$ bash tests/lemond_onebit.sh                        # branch
...
PASS: tests/lemond_onebit.sh                         (rc 0)

$ git show origin/main:scripts/lemond-onebit.sh > $P/scripts/lemond-onebit.sh
$ bash $P/tests/lemond_onebit.sh
ok   the launcher starts bin/lemond (exit 0)
ok   argv reaches lemond unchanged
ok   LEMONADE_ONEBIT_BIN still defaults to the payload's engine
ok   the launcher still requires sealed NPU kernels
FAIL LEMONADE_HRX_HRX_BIN names the payload's lemonade-hrx
FAIL the named path is the executable the payload ships
FAILED: tests/lemond_onebit.sh                       (rc 1)

Gate:

$ scripts/pre-pr-checks.sh --tree-only --base origin/main
pre-pr-checks: all 16 check(s) green, 2 skipped, 0 could not be told, 2 open-PR row(s) not run (--tree-only)

The two skips are tools/ci/hip_f16_audit.py and tools/ci/kernel_id_selftest.py not finding a gpu-kernels
tree on this host (GPU_KERNELS_DIR unset) — environment, not the diff.

NOT verified — the on-device control

The strixhalo box was queue-deep (one holder plus ~10 box-hold tickets from other lanes), so the on-device
control was not run
: neither the running lemond's environ showing LEMONADE_HRX_HRX_BIN, nor a -HRX model
loading and answering on HRX0. This PR therefore claims the wiring that the fork's own code and the host-side row
assert — not that a -HRX model answers.

One ticket, already staged on the box (/home/bcloud/l3399/run.sh contains a read-only stock-backend env matrix,
the OLD launcher's lemond load of Qwen3-4B-Instruct-2507-HRX — expected to fail with invalid device: HRX0 —
and the NEW launcher's load + chat completion on HRX0):

scp scripts/lemond-onebit.sh strixhalo:/home/bcloud/l3399/lemond-onebit-new    # the script reads it from there
ssh strixhalo "BOX_HOLD_WHO=<who> box-hold both 'sudo -n timeout 900 bash /home/bcloud/l3399/run.sh'"

That control would prove what the host-side row cannot: that lemond, in the appliance's own environment, actually
starts the payload's lemonade-hrx and that the resulting llama-server registers HRX0 and answers — the closure
criterion in #3399. The host row only proves that the environment names an existing executable.

Review risk

  • The change is one default: a caller/host that deliberately wants Lemonade's own HRX download must now set
    LEMONADE_HRX_HRX_BIN=builtin (documented in docs/lemonade.md).
  • The new hrx-recipe release-check row will FAIL on any image whose lemond was not started through
    lemond-onebit (e.g. started by hand as bin/lemond); that is intended, but it is the row most worth a second
    look before it ships.
  • 1bit/lemonade-hrx is a script, and Lemonade's validate_bin_path only requires the path to exist; the row and
    the ctest test check -x, and scripts/package-linux.sh normalises modes, so a non-executable shim is not
    expected — but if a packaging change ever drops the execute bit, -HRX loads fail with a config error rather
    than silently downloading upstream's bundle.

Refs #3399


Rebased onto main c18d690 (24 Nov, 08:50Z). The branch was 11 commits behind and conflicted only with #3437's NPU idle-eviction row: main added npu_idle_evict_verdict and its self-test cases exactly where this PR adds hrx_recipe_verdict and its own, so both sides are kept - the rebase drops nothing (5 files, +202/-0, the same diff as before). Re-ran on the rebased tree: tests/lemond_onebit.sh PASS, os/mini/release-check.sh --self-test PASS, scripts/pre-pr-checks.sh --base origin/main 16 green, 4 skipped, 0 cannot-tell. mergeable is now MERGEABLE; the pending checks are this push's run.

@bong-water-water-bong
bong-water-water-bong enabled auto-merge (squash) November 24, 2026 08:22
…ipe at the payload's own HRX backend

Lemonade's stock llamacpp-hrx recipe (upstream's, not our onebit recipe) is what the *-HRX catalogue rows
name. Nothing in the release package pointed it at a local build, so lemond's BackendManager downloaded
llamacpp-hrx/hrx (version.txt hrx-b99) on first use and ran that. On 1bit OS it registers no GPU:
llama-server --list-devices printed "Available devices: (none)" under lemond's environment, and a load
failed with 'error while handling argument "--device": invalid device: HRX0' (engine#3399, measured on
v2026.48; the appliance's live catalogue lists 29 of those rows). The stock recipe's
build_server_environment() adds only GGML_DISABLE_VULKAN to the child
(third_party/lemonade src/cpp/server/backends/hrx/hrx_server.cpp), and the running lemond's environment
carries the save-area trio + LD_LIBRARY_PATH but no IREE_HAL_AMDGPU_LIBHSA_PATH - the state
scripts/hrx-env.sh:24-28 measures as "the system ROCr, which with HSA_USE_SVM=0 registers no HRX0".

The payload already ships an HRX llama-server built from our pins (1bit/hrx/llama/bin,
scripts/package-linux.sh:59) and the shim that gives it serve's HRX environment (1bit/lemonade-hrx,
scripts/package-linux.sh:202). The one place that should have wired the two together is the launcher every
appliance start goes through (os/v3/puppy/embed/etc/init.d/10lemonade -> /opt/1bit-package/lemond-onebit),
and it did not:

- scripts/lemond-onebit.sh: export LEMONADE_HRX_HRX_BIN to $here/1bit/lemonade-hrx unless the caller set
  it. Lemonade reads that name before hrx.hrx_bin in config.json (backend_utils.cpp:319-381
  get_bin_config_value builds "LEMONADE_" + section + "_" + bin_key), and a path makes
  find_external_backend_binary return it before install_from_github's needs_install check
  (backend_utils.cpp:332-368, :540-548), so the upstream download stops happening too. A caller's value
  wins and `builtin` is the documented opt-out to Lemonade's own download.
- tests/lemond_onebit.sh (+ ctest row lemond_onebit): the launcher's environment and argv as a fake
  payload's bin/lemond records them; no build, no device, no engine.
- os/mini/release-check.sh: row hrx-recipe reads the RUNNING lemond's environment (lemond_environ, the
  listener found by socket inode as lemond_key does) and fails when it names no payload backend, or a path
  that does not exist or is not executable; skips when the image starts lemond without the package
  launcher, the catalogue has no -HRX row, or the environment cannot be read. hrx_recipe_verdict is pure
  and --self-test drives six cases including the empty value (the v2026.48 state).
- docs/lemonade.md: the appliance/package wiring next to the Ubuntu PPA one.

Evidence (host, this branch):
  $ ctest --test-dir build -R 'lemond_onebit|release_check_selftest'
  1/2 Test #45: lemond_onebit ....................   Passed    0.06 sec
  2/2 Test #50: release_check_selftest ...........   Passed    0.66 sec

  Control - the same test against origin/main's launcher, in a throwaway copy with only the new test:
  $ bash tests/lemond_onebit.sh                    # branch
  ...
  PASS: tests/lemond_onebit.sh                     (rc 0)
  $ git show origin/main:scripts/lemond-onebit.sh > prefix/scripts/lemond-onebit.sh
  $ bash prefix/tests/lemond_onebit.sh
  FAIL LEMONADE_HRX_HRX_BIN names the payload's lemonade-hrx
  FAIL the named path is the executable the payload ships
  FAILED: tests/lemond_onebit.sh                   (rc 1)

  $ scripts/pre-pr-checks.sh --tree-only --base origin/main
  pre-pr-checks: all 16 check(s) green, 2 skipped, 0 could not be told, 2 open-PR row(s) not run (--tree-only)
  (the two skips are tools/ci/hip_f16_audit.py and tools/ci/kernel_id_selftest.py finding no gpu-kernels
  tree on this host - environment, not the diff)

NOT RUN: the on-device control. The strixhalo box was queue-deep (one holder plus about ten box-hold
tickets from other lanes), so the running lemond's environ and a -HRX load on HRX0 were NOT measured. The
staged one-ticket script is /home/bcloud/l3399/run.sh on the box (re-copy
scripts/lemond-onebit.sh to /home/bcloud/l3399/lemond-onebit-new first):
  ssh strixhalo "BOX_HOLD_WHO=<who> box-hold both 'sudo -n timeout 900 bash /home/bcloud/l3399/run.sh'"
It prints the stock --list-devices matrix, the OLD launcher's lemond load of Qwen3-4B-Instruct-2507-HRX
(expected to fail with invalid device: HRX0) and the NEW launcher's load + chat completion on HRX0.
Without it this commit claims the wiring the fork's code and the host row assert, not that a -HRX model
answers.

Refs #3399
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

PR Reviewer Guide 🔍

(Review updated until commit de2263d)

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

3399 - Partially compliant

Compliant requirements:

  • The PR fixes the issue by ensuring that the *-HRX catalogue rows use the payload's own HRX backend instead of upstream's hrx-b99 bundle
  • The scripts/lemond-onebit.sh now exports LEMONADE_HRX_HRX_BIN to point to $here/1bit/lemonade-hrx by default
  • The release-check.sh now includes a check to verify that the running lemond's environment correctly points to the payload's HRX backend

Non-compliant requirements:

Requires further human verification:

715 - Partially compliant

Compliant requirements:

  • The PR does not directly address the underlying HSA/SVM compatibility issues that cause the page faults

Non-compliant requirements:

  • The PR does not implement automatic detection and setting of the no-SVM environment trio
  • The PR does not include explicit libhsa path logging or runtime selection logic

Requires further human verification:

3437 - Partially compliant

Compliant requirements:

  • The PR does not directly address the idle eviction issue, which is outside the scope of this specific fix

Non-compliant requirements:

  • The PR does not implement the suggested fix of setting recipe_options for NPU models to enable auto_evict

Requires further human verification:

  • Verification that the idle eviction behavior is properly handled for NPU models
⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Incorrect default path for HRX backend

The default path for LEMONADE_HRX_HRX_BIN assumes that the 1bit/lemonade-hrx binary is located in the same directory as the script. This may not be true in all deployment scenarios, potentially causing the HRX backend to fail to load. The path should be made more robust to handle different deployment layouts.

export LEMONADE_HRX_HRX_BIN=${LEMONADE_HRX_HRX_BIN:-$here/1bit/lemonade-hrx}
Environment variable validation

The hrx_recipe_verdict function in release-check.sh does not properly validate that the LEMONADE_HRX_HRX_BIN environment variable is set correctly. If the variable is set to a non-existent path, the function will not detect this and will proceed with a false positive pass. This could lead to a scenario where the system believes it's using the correct backend, but actually fails to load the HRX models.

hrx_recipe_verdict() {  # <LEMONADE_HRX_HRX_BIN from lemond's environ, or empty> <exists 1/0> <executable 1/0>
    case "${1:-}" in
        '')
            printf 'FAIL lemond has no LEMONADE_HRX_HRX_BIN: its llamacpp-hrx recipe would install upstream hrx-b99, which registers no HRX0 on this GPU'
            return 0 ;;
        builtin)
            printf "SKIP LEMONADE_HRX_HRX_BIN=builtin: this image deliberately uses Lemonade's own HRX download"
            return 0 ;;
    esac
    case "$1" in
        /*) ;;
        *)  printf 'FAIL LEMONADE_HRX_HRX_BIN=%s is not a path, so Lemonade installs its own HRX build instead' "$1"
            return 0 ;;
    esac
    [ "${2:-0}" = 1 ] || { printf 'FAIL LEMONADE_HRX_HRX_BIN=%s does not exist' "$1"; return 0; }
    [ "${3:-0}" = 1 ] || { printf 'FAIL LEMONADE_HRX_HRX_BIN=%s is not executable, so lemond cannot start it' "$1"; return 0; }
    printf "PASS lemond runs the payload's own HRX backend for its llamacpp-hrx recipe: %s" "$1"
}
✅ Resolved findings

scripts/lemond-onebit.sh:41

Default value may not be portable

The default value for LEMONADE_HRX_HRX_BIN in lemond-onebit.sh assumes that the 1bit/lemonade-hrx binary is located in the same directory as the script. This may not be true in all deployment scenarios, potentially causing the HRX backend to fail to load.

os/mini/release-check.sh:1227-1244

Incorrect environment variable handling

The hrx_recipe_verdict function in release-check.sh does not properly validate that the LEMONADE_HRX_HRX_BIN environment variable is set correctly. If the variable is set to a non-existent path, the function will not detect this and will proceed with a false positive pass. This could lead to a scenario where the system believes it's using the correct backend, but actually fails to load the HRX models.

… --port literal the row feeds the stub (engine#3399)
@bong-water-water-bong
bong-water-water-bong merged commit 43bc5b3 into main Nov 24, 2026
10 of 11 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the fix/3399-hrx-recipe branch November 24, 2026 09:14
@github-actions

Copy link
Copy Markdown

Persistent review updated to latest commit de2263d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant