hermes-agent/tests/pm/test_llamacpp_pins.py
emozilla 9c1ef17550 fix(local-runtime): move a pre-PM llama.cpp engine into the PM store and pin b10964
The package-manager switch (#102765) made engine detection read only PM's
store and pinned every llama.cpp backend to b10362. A machine with an
engine under runtimes/llamacpp/b<tag>/<backend>/ reported no engine, so
the local models pane showed one-click setup with models already on disk.

installed_engine() now moves the newest pre-PM install into the store
once. The old manifest's archive digests become the PM identity, the
package verifier runs llama-server --version, and os.rename puts the
directory in place before facts.json records it. A store that already
holds an engine is left alone, a store lock held by another PM operation
defers the move, and an install that fails verification stays where it
is for the rest of the process.

The lock returns to b10964 on all five backends, the default before the
PM switch. With b10362 pinned, the pane offered a downgrade from the
moved engine as an update. Upstream renamed the ROCm archives to 10.0 at
b10767, and the hip assets follow. Only the CUDA build is measured at
b10964.
2026-09-25 22:07:48 -04:00

29 lines
1.2 KiB
Python

"""Every supported local engine backend installs only reviewed PM artifacts."""
import pm
from pm import paths
from pm.lock import Lockfile
from pm.store import ALL_TARGETS
def test_llamacpp_backends_have_pins_for_their_supported_targets():
lock = Lockfile(paths.lockfile_path())
backends = ("cpu", "cuda", "vulkan", "metal", "hip")
# One engine build everywhere: the catalog and presets are calibrated against a single tag.
assert len({lock.version(f"llamacpp-{backend}") for backend in backends}) == 1
for backend in backends:
name = f"llamacpp-{backend}"
package = pm.get_package(name)
version = lock.version(name)
assert version
for target in ALL_TARGETS:
artifacts = lock.artifacts(name, target)
if package.missing_reason(target):
assert not artifacts
continue
assert artifacts
assert [a["url"] for a in artifacts] == package.fetch_urls(version, target)
assert all(len(bytes.fromhex(a["sha256"])) == 32 for a in artifacts)
if backend == "cuda":
assert len(artifacts) == 2
assert any("cudart-" in a["url"] for a in artifacts)