The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(local-runtime): launch and growth decisions price against capacity, not live-free VRAM
emozilla860ee2499128
diff --git a/hermes_cli/local_runtime/bootstrap.py b/hermes_cli/local_runtime/bootstrap.pyindex d078832db05..802621f7805 100644--- a/hermes_cli/local_runtime/bootstrap.py+++ b/hermes_cli/local_runtime/bootstrap.py@@ -157,11 +157,16 @@ def ensure_local_runtime(config: dict, force: bool = False) -> "object | None":mdir = models_dir()mdir.mkdir(parents=True, exist_ok=True)- # Context policy: one launch decision per staged model,- # carried to the router via the preset INI.+ # Context policy: one launch decision per staged model, carried to+ # the router via the preset INI. Priced against CAPACITY, not live+ # free VRAM: this runs while the outgoing server instance may still+ # hold the card (restart, refresh after a download), and its memory+ # is freed before the new instance loads anything. Pricing against+ # live-free here once pinned a fitting model's weights to CPU+ # because the probe saw the predecessor's VRAM as gone.preset_path = get_hermes_home() / "runtimes" / "llamacpp" / "presets.ini"try:- entries = generate_presets(mdir, probe_budget(), preset_path)+ entries = generate_presets(mdir, probe_budget(planning=True), preset_path)for entry in entries:if entry.refusal:logger.warning("model refused by physics check: %s", entry.refusal)diff --git a/hermes_cli/local_runtime/growth.py b/hermes_cli/local_runtime/growth.pyindex 6ca09cc285d..a83001141c6 100644--- a/hermes_cli/local_runtime/growth.py+++ b/hermes_cli/local_runtime/growth.py@@ -114,7 +114,11 @@ def maybe_grow_window(model_id: str, *, base_url: str, session_tokens: int,server_idle = Falsedecision = growth_decision(- profile, probe_budget(),+ # Capacity budget, not live-free: growth executes via a server+ # bounce, so the grown instance loads onto a freed card. Live-free+ # here is distorted by the very model being grown — it reads its+ # own residency as unavailable and vetoes rungs that fit.+ profile, probe_budget(planning=True),current_window=current_window,session_tokens=session_tokens,measured_decode_tok_s=measured_decode_tok_s,diff --git a/tests/hermes_cli/test_budget_source.py b/tests/hermes_cli/test_budget_source.pynew file mode 100644index 00000000000..744997f2be1--- /dev/null+++ b/tests/hermes_cli/test_budget_source.py@@ -0,0 +1,51 @@+"""Launch and growth decisions must price against CAPACITY, not live-free+VRAM. Both execute through a server bounce — the outgoing instance's memory+is freed before the new one loads — so a probe that reads the predecessor's+(or the grown model's own) residency as 'gone' vetoes configurations that+genuinely fit. Symptom when this regresses: a model the pane promised+'144K on GPU' launches with its weights pinned to CPU and single-digit+tokens/s while the card sits 60% empty."""++from __future__ import annotations++import ast+import inspect+++def _planning_probe_calls(source: str) -> list[bool]:+ """Every probe_budget(...) call's planning= value in the source."""+ tree = ast.parse(source)+ out = []+ for node in ast.walk(tree):+ if (isinstance(node, ast.Call)+ and getattr(node.func, "id", getattr(node.func, "attr", ""))+ == "probe_budget"):+ planning = any(+ kw.arg == "planning"+ and isinstance(kw.value, ast.Constant)+ and kw.value.value is True+ for kw in node.keywords)+ out.append(planning)+ return out+++def test_bootstrap_presets_price_against_capacity():+ import hermes_cli.local_runtime.bootstrap as bootstrap++ calls = _planning_probe_calls(inspect.getsource(bootstrap))+ assert calls, "bootstrap no longer probes a budget? update this test"+ assert all(calls), (+ "bootstrap prices launch decisions against live-free VRAM; a "+ "restart/refresh probes while the outgoing server still holds the "+ "card, pinning fitting models to CPU")+++def test_growth_refit_prices_against_capacity():+ import hermes_cli.local_runtime.growth as growth++ calls = _planning_probe_calls(inspect.getsource(growth))+ assert calls, "growth no longer probes a budget? update this test"+ assert all(calls), (+ "growth re-fits against live-free VRAM; the grown model's own "+ "residency reads as unavailable and vetoes rungs that fit the "+ "post-bounce card")