The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(local-runtime): hermes update from v2026.9.24 no longer crashes importing local_runtime
alt-glitch53fefae5d743
diff --git a/hermes_cli/local_runtime/__init__.py b/hermes_cli/local_runtime/__init__.pyindex 6aafeb1e072..6c29b9089e2 100644--- a/hermes_cli/local_runtime/__init__.py+++ b/hermes_cli/local_runtime/__init__.py@@ -6,21 +6,38 @@ engine is installed (the engine bytes live in pm's machine-wide store);download; ``supervisor`` spawns and supervises one llama-server in routermode (readiness is a touch generation, never health-200 alone); ``detect``finds an already-running llama-server (external or ours).++The package-level names resolve on first access. Shipped updaters import+``hermes_cli.local_runtime.processes`` from the NEW checkout after the pull,+while their process still holds the OLD ``hermes_platform`` and other+first-party modules. An eager re-export here would run every submodule+against those stale modules and crash the update on any name added since."""-from hermes_cli.local_runtime.binaries import ( # noqa: F401- BACKEND_PACKAGES, BinaryResolutionError, Engine, ensure_engine,- installed_engine, pinned_tag, resolve_backend, select_backend)-from hermes_cli.local_runtime.bootstrap import ensure_local_runtime, shutdown_local_runtime # noqa: F401-from hermes_cli.local_runtime.context_policy import ( # noqa: F401- FLOOR, growth_decision, initial_window, ladder, launch_args)-from hermes_cli.local_runtime.growth import ( # noqa: F401- clear_window_override, load_window_overrides, maybe_grow_window, save_window_override)-from hermes_cli.local_runtime.detect import detect_server # noqa: F401-from hermes_cli.local_runtime.endpoint import resolve_llamacpp_endpoint # noqa: F401-from hermes_cli.local_runtime.estimator import ( # noqa: F401- HardwareBudget, ctx_bytes, physics_check, profile_from_gguf)-from hermes_cli.local_runtime.gguf import read_gguf_header # noqa: F401-from hermes_cli.local_runtime.hardware import probe_budget # noqa: F401-from hermes_cli.local_runtime.presets import generate_presets # noqa: F401-from hermes_cli.local_runtime.supervisor import LlamaServerSupervisor # noqa: F401+from importlib import import_module++_EXPORTS = {+ "binaries": ("BACKEND_PACKAGES", "BinaryResolutionError", "Engine", "ensure_engine",+ "installed_engine", "pinned_tag", "resolve_backend", "select_backend"),+ "bootstrap": ("ensure_local_runtime", "shutdown_local_runtime"),+ "context_policy": ("FLOOR", "growth_decision", "initial_window", "ladder", "launch_args"),+ "growth": ("clear_window_override", "load_window_overrides", "maybe_grow_window",+ "save_window_override"),+ "detect": ("detect_server",),+ "endpoint": ("resolve_llamacpp_endpoint",),+ "estimator": ("HardwareBudget", "ctx_bytes", "physics_check", "profile_from_gguf"),+ "gguf": ("read_gguf_header",),+ "hardware": ("probe_budget",),+ "presets": ("generate_presets",),+ "supervisor": ("LlamaServerSupervisor",),+}+_SOURCE = {name: module for module, names in _EXPORTS.items() for name in names}+++def __getattr__(name: str):+ module = _SOURCE.get(name)+ if module is None:+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")+ value = getattr(import_module(f"{__name__}.{module}"), name)+ globals()[name] = value+ return valuediff --git a/tests/hermes_cli/test_local_runtime_package_import.py b/tests/hermes_cli/test_local_runtime_package_import.pynew file mode 100644index 00000000000..5313150c365--- /dev/null+++ b/tests/hermes_cli/test_local_runtime_package_import.py@@ -0,0 +1,30 @@+"""Shipped updaters import ``hermes_cli.local_runtime.processes`` from the new tree mid-update.++v2026.9.24's ``_subprocess_compat.bounded_probe_run`` lazily imports+``spawn_server`` after the pull, inside a process that still holds the old+``hermes_platform`` and other first-party modules. Importing that one+submodule must not run the rest of the package, or any name added to an+already-loaded module since the release crashes ``hermes update``.+"""++import subprocess+import sys++_PROBE = (+ "import sys\n"+ "import hermes_cli.local_runtime.processes\n"+ "loaded = sorted(m for m in sys.modules if m.startswith(('hermes_platform', 'hermes_cli.local_runtime.')))\n"+ "print('\\n'.join(loaded))\n"+)+++def test_processes_import_runs_no_other_local_runtime_module():+ out = subprocess.run([sys.executable, "-c", _PROBE], capture_output=True, text=True, check=True).stdout+ assert out.split() == ["hermes_cli.local_runtime.processes"]+++def test_package_exports_still_resolve():+ import hermes_cli.local_runtime as local_runtime+ from hermes_cli.local_runtime.hardware import probe_budget++ assert local_runtime.probe_budget is probe_budget