Skip to content

The agent that grows with you

fix: trim llamacpp salvage to invariant tests, drop redundant config load, document fixed-port servers

teknium134fb4ab4820f
diff --git a/contributors/emails/hermes@local b/contributors/emails/hermes@local
new file mode 100644
index 00000000000..96c23015c73
--- /dev/null
+++ b/contributors/emails/hermes@local
@@ -0,0 +1 @@
+Finn763
diff --git a/hermes_cli/local_runtime/endpoint.py b/hermes_cli/local_runtime/endpoint.py
index 8f31e9e76b4..e1649d5315d 100644
--- a/hermes_cli/local_runtime/endpoint.py
+++ b/hermes_cli/local_runtime/endpoint.py
@@ -88,12 +88,6 @@ def resolve_llamacpp_endpoint(config: dict | None = None,
from hermes_cli.local_runtime.detect import detect_server
- # ``local_runtime.detect_ports`` is the documented knob for an external llama-server on a
- # non-default port, but every provider-resolution caller invokes this bare — without loading the
- # config here the knob was dead on the only paths that need it, so a server on e.g. :8010 stayed
- # undetected and `provider: llamacpp` resolved to nothing.
- with suppress(Exception):
- config = _load_config_if_none(config)
ports = ((config or {}).get("local_runtime") or {}).get("detect_ports") or []
hit = detect_server(extra_ports=tuple(int(p) for p in ports))
if hit and not hit.auth_required:
diff --git a/tests/hermes_cli/test_local_runtime.py b/tests/hermes_cli/test_local_runtime.py
index 61edb297dcf..9448ea5da30 100644
--- a/tests/hermes_cli/test_local_runtime.py
+++ b/tests/hermes_cli/test_local_runtime.py
@@ -787,7 +787,7 @@ def test_runtime_provider_seam_llamacpp_alias(tmp_path, monkeypatch, stub_server
def test_configured_llamacpp_provider_wins_over_managed_alias(tmp_path, monkeypatch):
- """A providers.llamacpp endpoint is explicit configuration, not a managed-runtime request."""
+ """A providers.llamacpp endpoint is explicit configuration, not a managed-runtime request (#116143)."""
monkeypatch.setenv("HERMES_HOME", str(tmp_path / ".hermes"))
monkeypatch.setattr(
"hermes_cli.config.load_config",
@@ -818,29 +818,6 @@ def test_configured_llamacpp_provider_wins_over_managed_alias(tmp_path, monkeypa
assert runtime["source"].startswith("custom_provider:")
-def test_llamacpp_runtime_forwards_detect_ports_config(monkeypatch):
- """The managed-alias fallback passes local_runtime.detect_ports to endpoint detection."""
- config = {"local_runtime": {"enabled": True, "detect_ports": [8081]}}
- monkeypatch.setattr("hermes_cli.config.load_config", lambda: config)
- seen = []
-
- def _resolve(passed_config, **kwargs):
- seen.append(passed_config)
- return {"base_url": "http://127.0.0.1:8081/v1", "api_key": ""}
-
- monkeypatch.setattr(
- "hermes_cli.local_runtime.endpoint.resolve_llamacpp_endpoint",
- _resolve,
- )
- from hermes_cli.runtime_provider import _resolve_named_custom_runtime
-
- runtime = _resolve_named_custom_runtime(requested_provider="llamacpp")
-
- assert seen == [config]
- assert runtime is not None
- assert runtime["base_url"] == "http://127.0.0.1:8081/v1"
-
-
def test_runtime_provider_seam_explicit_base_url_wins(tmp_path, monkeypatch):
"""A user-specified base_url must never be overridden by the managed
endpoint — pointing at a specific server means that server."""
@@ -872,7 +849,7 @@ def test_staged_local_model_resolves_without_a_running_server(tmp_path, monkeypa
"""The picker's Local row exists from staged GGUFs alone (contract: selectable before the server
runs — selection starts it through the runtime seam). Selecting one must reach that seam instead
of dying at the provider gate with "Unknown provider 'llamacpp'": the row's id and the resolver's
- are one definition, so an id the picker offers always resolves."""
+ are one definition, so an id the picker offers always resolves (#116249)."""
monkeypatch.setenv("HERMES_HOME", str(tmp_path / ".hermes"))
_stage_local_model(tmp_path / ".hermes", "Qwen3.8-27B-IQ3_S-mtp")
monkeypatch.setattr("hermes_cli.local_runtime.detect.DEFAULT_PROBE_PORTS", ())
@@ -894,21 +871,10 @@ def test_staged_local_model_resolves_without_a_running_server(tmp_path, monkeypa
assert "local model server" in error.lower(), error
-def test_llamacpp_id_stays_unresolved_without_models_or_server(tmp_path, monkeypatch):
- """Nothing staged and nothing running: the alias is still unknown — admitting it unconditionally
- would offer a provider with neither a model nor an endpoint."""
- monkeypatch.setenv("HERMES_HOME", str(tmp_path / ".hermes"))
- monkeypatch.setattr("hermes_cli.local_runtime.detect.DEFAULT_PROBE_PORTS", ())
-
- from hermes_cli.providers import resolve_provider_full
-
- assert resolve_provider_full("llamacpp", {}, []) is None
-
-
def test_external_server_on_a_configured_detect_port_is_used(tmp_path, monkeypatch, stub_server):
"""A llama-server the user runs on a fixed non-default port is what `provider: llamacpp` resolves
to when that port is declared in local_runtime.detect_ports — the knob is documented for exactly
- this, and every provider path calls the endpoint resolver without a config."""
+ this, and every provider path called the endpoint resolver without a config (#116143, #116249)."""
port, handler = stub_server
handler.props = {"build_info": "b10964-test", "model_path": "/models/ext-model.gguf",
"default_generation_settings": {"n_ctx": 4096}}
diff --git a/website/docs/user-guide/local-models.md b/website/docs/user-guide/local-models.md
index 9f379aeec1f..1783667e6c1 100644
--- a/website/docs/user-guide/local-models.md
+++ b/website/docs/user-guide/local-models.md
@@ -123,8 +123,27 @@ local_runtime:
backend: auto # auto | cuda | metal | vulkan | hip | cpu
tag: b10362 # pinned llama.cpp release; Hermes updates it with
# each release after re-validation
+ detect_ports: [8081] # extra ports to probe for a llama-server you run
+ # yourself (the default probe is :8080 only)
```
+Running `llama-server` yourself on a fixed port works with the same
+`model.provider: llamacpp` selection — either list the port in
+`local_runtime.detect_ports`, or define the endpoint explicitly under
+`providers:` (an explicit entry wins over server detection):
+
+```yaml
+providers:
+ llamacpp:
+ base_url: http://127.0.0.1:8081/v1
+ model: my-model
+```
+
+The `/model` → **Local** picker row and `provider: llamacpp` resolve to that
+server; with no server reachable the error names the local runtime ("the local
+model server isn't running") instead of an unknown-provider or missing-API-key
+message.
+
Models and runtime builds live under the Hermes home directory
(`models/` and `runtimes/llamacpp/`). Selecting a local model as your
main model uses the standard `model.provider: llamacpp` +