The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(local-runtime): find nvidia-smi in WSL driver path
Gille485aaf69b7f0
diff --git a/hermes_cli/local_runtime/hardware.py b/hermes_cli/local_runtime/hardware.pyindex 9dc51bc9af2..0f8e2c1ce38 100644--- a/hermes_cli/local_runtime/hardware.py+++ b/hermes_cli/local_runtime/hardware.py@@ -117,7 +117,7 @@ _smi_path_cache: "tuple[str | None] | None" = Nonedef _nvidia_smi_path() -> str | None:"""Absolute path to nvidia-smi, or None. PATH first (respects user overrides), then the- driver's known Windows install locations; on Linux/WSL the PATH lookup is the whole ladder."""+ driver's known install locations on Windows and WSL."""global _smi_path_cacheif _smi_path_cache is not None:return _smi_path_cache[0]@@ -132,6 +132,12 @@ def _nvidia_smi_path() -> str | None:/ "NVIDIA Corporation" / "NVSMI" / "nvidia-smi.exe",)found = next((str(c) for c in candidates if c.exists()), None)+ elif found is None and sys.platform.startswith("linux"):+ # The Windows display driver exposes nvidia-smi here inside WSL, but does not guarantee+ # that the directory is present on PATH.+ candidate = Path("/usr/lib/wsl/lib/nvidia-smi")+ if candidate.exists():+ found = str(candidate)_smi_path_cache = (found,)return founddiff --git a/tests/hermes_cli/test_unified_pool_quirk.py b/tests/hermes_cli/test_unified_pool_quirk.pyindex 39c7c23ed7e..881fc9a5570 100644--- a/tests/hermes_cli/test_unified_pool_quirk.py+++ b/tests/hermes_cli/test_unified_pool_quirk.py@@ -14,6 +14,10 @@ any discrete card."""from __future__ import annotations+from pathlib import Path++import pytest+import hermes_cli.local_runtime.hardware as hwGIB = 1 << 30@@ -185,6 +189,18 @@ def test_smi_resolver_caches_and_survives_empty_path(monkeypatch):assert len(calls) == 1[email protected]_only+def test_smi_resolver_uses_wsl_driver_path_when_path_is_empty(monkeypatch):+ """WSL exposes nvidia-smi through the Windows driver directory even+ when a service PATH cannot resolve it."""+ wsl_smi = Path("/usr/lib/wsl/lib/nvidia-smi")+ monkeypatch.setattr(hw, "_smi_path_cache", None)+ monkeypatch.setattr(hw.shutil, "which", lambda name: None)+ monkeypatch.setattr(hw.Path, "exists", lambda candidate: candidate == wsl_smi)++ assert hw._nvidia_smi_path() == str(wsl_smi)++# ── probe cache ──────────────────────────────────────────────