The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(local-runtime): preset generation crashed on every catalog model with a vision projector
emozilla411a37c95c14
diff --git a/hermes_cli/local_runtime/bootstrap.py b/hermes_cli/local_runtime/bootstrap.pyindex 77eb1fc8a93..13f57569e6d 100644--- a/hermes_cli/local_runtime/bootstrap.py+++ b/hermes_cli/local_runtime/bootstrap.py@@ -225,8 +225,20 @@ def ensure_local_runtime(config: dict, force: bool = False) -> "object | None":if entry.refusal:logger.warning("model refused by physics check: %s", entry.refusal)except Exception as exc: # noqa: BLE001 — policy failure must not block serving- logger.warning("preset generation failed (%s); router runs stock fit", exc)- preset_path = None+ # Degradation ladder: a STALE policy still beats no policy —+ # stock fit (f16 KV at max context, no placement) is the+ # silent-busy-wait failure on Windows. Keep serving with the+ # previous INI when one exists; only a first boot with no INI+ # at all falls to stock fit.+ if preset_path.exists():+ logger.error("preset generation failed (%s); serving with the "+ "PREVIOUS launch policies — models staged since "+ "the last successful generation run unpoliced "+ "until this is fixed", exc)+ else:+ logger.error("preset generation failed (%s) and no previous "+ "policy file exists; router runs stock fit", exc)+ preset_path = Nonesup = LlamaServerSupervisor(install_dir, mdir,diff --git a/hermes_cli/local_runtime/presets.py b/hermes_cli/local_runtime/presets.pyindex 6bd7f507abf..55f83d82f20 100644--- a/hermes_cli/local_runtime/presets.py+++ b/hermes_cli/local_runtime/presets.py@@ -89,7 +89,8 @@ def generate_presets(models_dir: Path, budget: HardwareBudget,continue# Overhead beyond weights+KV: runtime buffers, plus the vision# projector when this model ships one (it loads beside the weights).- entry = find_entry_for_model(model_id)+ hit = find_entry_for_model(model_id)+ entry = hit[0] if hit is not None else Nonemmproj_bytes = 0if entry is not None and entry.mmproj is not None:mmproj_path = assets_dir() / entry.mmproj.local_namediff --git a/tests/hermes_cli/test_local_growth.py b/tests/hermes_cli/test_local_growth.pyindex 2b0e9f77ea4..cfe0768dbf8 100644--- a/tests/hermes_cli/test_local_growth.py+++ b/tests/hermes_cli/test_local_growth.py@@ -104,6 +104,37 @@ def _tiny_profile(model_id: str):layers=[(LayerKind.FULL, 512)] * 4)+def test_preset_generation_for_catalog_model_with_mmproj(hermes_home, tmp_path, monkeypatch):+ """generate_presets must survive a model that IS in the catalog and+ carries a vision projector — this executes the find_entry_for_model ++ mmproj overhead branch that synthetic test models skip. Regression:+ the branch once treated the (entry, variant) tuple as the entry and+ crashed every real boot into the stock-fit fallback."""+ import hermes_cli.local_runtime.presets as presets_mod++ from hermes_cli.local_runtime.catalog import CATALOG+ from hermes_cli.local_runtime.estimator import HardwareBudget++ # A real catalog id with an mmproj (the recommended row has one).+ entry = next(e for e in CATALOG if e.mmproj is not None)+ variant = entry.variants[-1]+ mdir = tmp_path / "models"+ _stage_fake_gguf(mdir, variant.model_id)++ monkeypatch.setattr(presets_mod, "read_gguf_header", lambda p: p)+ monkeypatch.setattr(presets_mod, "profile_from_gguf",+ lambda h: _tiny_profile(variant.model_id))++ gib = 1 << 30+ budget = HardwareBudget(usable_vram_bytes=24 * gib,+ total_device_bytes=24 * gib,+ ram_available_bytes=64 * gib)+ entries = presets_mod.generate_presets(mdir, budget, tmp_path / "p.ini")+ assert len(entries) == 1+ assert entries[0].refusal is None+ assert entries[0].window > 0++def test_preset_restores_grown_window_capped_at_native(hermes_home, tmp_path, monkeypatch):"""A persisted override lifts the preset window; an absurd override iscapped at native. GGUF parsing is stubbed — the contract under test is