From aef409343d478accb97e801bbebbbc7442821ac6 Mon Sep 17 00:00:00 2001 From: Leanolf Date: Fri, 4 Sep 2026 17:39:09 +0200 Subject: [PATCH] fix(local-models): point _assign_default's late-bound model assignment at web_server_config The whole-codebase refactor moved _apply_model_assignment_sync from the web_server facade into web_server_config, but _assign_default in web_routers/local_models.py still resolved it through the default late() module (web_server), which no longer carries the symbol. A local-model quickstart therefore failed its final 'making it your default' step with AttributeError: module 'hermes_cli.web_server' has no attribute '_apply_model_assignment_sync'. Pass the defining module explicitly to web_deps.late() so the call resolves against hermes_cli.web_server_config, matching how the sibling models.py router imports the same helper. Update the two quickstart test stubs to accept the module argument the real late(name, module=...) takes. --- hermes_cli/web_routers/local_models.py | 2 +- tests/hermes_cli/test_local_quickstart.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hermes_cli/web_routers/local_models.py b/hermes_cli/web_routers/local_models.py index 1044053fc1..c07fee82ca 100644 --- a/hermes_cli/web_routers/local_models.py +++ b/hermes_cli/web_routers/local_models.py @@ -270,7 +270,7 @@ def _ensure_server(job: Dict[str, Any], config: dict, model_id: str, *, fail_det def _assign_default(job: Dict[str, Any], model_id: str) -> None: """Make ``model_id`` the main model via the same machinery as /api/model/set (late-bound: tests stub web_deps.late).""" _step(job, "setting-default", "Making it your default") - web_deps.late("_apply_model_assignment_sync")("main", "llamacpp", model_id, "", "", "") + web_deps.late("_apply_model_assignment_sync", "hermes_cli.web_server_config")("main", "llamacpp", model_id, "", "", "") # ── downloads: ranged parallel streams ─────────────────────── diff --git a/tests/hermes_cli/test_local_quickstart.py b/tests/hermes_cli/test_local_quickstart.py index f6a8f56193..e78360306e 100644 --- a/tests/hermes_cli/test_local_quickstart.py +++ b/tests/hermes_cli/test_local_quickstart.py @@ -84,7 +84,7 @@ def test_quickstart_runs_all_three_legs(client, monkeypatch, tmp_path): monkeypatch.setattr( web_deps, "late", - lambda name: (lambda *a, **k: calls.append("assign"))) + lambda name, module="hermes_cli.web_server": (lambda *a, **k: calls.append("assign"))) r = client.post("/api/local-models/quickstart", json={}) assert r.status_code == 200 @@ -137,7 +137,7 @@ def test_quickstart_skips_satisfied_legs(client, monkeypatch): monkeypatch.setattr( web_deps, "late", - lambda name: (lambda *a, **k: calls.append("assign"))) + lambda name, module="hermes_cli.web_server": (lambda *a, **k: calls.append("assign"))) r = client.post("/api/local-models/quickstart", json={}) assert r.status_code == 200