Skip to content

The agent that grows with you

fix(termux): preserve Nix update guidance

adybag14-cyber51de5c91b516
diff --git a/hermes_cli/config.py b/hermes_cli/config.py
index a5b9c1dc1ef..fed586e8a79 100644
--- a/hermes_cli/config.py
+++ b/hermes_cli/config.py
@@ -454,6 +454,10 @@ def detect_install_method(project_root: Optional[Path] = None) -> str:
See issue #34397.
"""
root = _install_method_project_root(project_root)
+ # "apt" is intentionally the Termux APT distribution identifier, not a
+ # generic Debian/Ubuntu APT signal. If another APT-managed distribution is
+ # added, give it a distinct install method or make update-command selection
+ # platform-aware instead of silently reusing Termux's `pkg` command.
supported_methods = {"apt", "docker", "nix", "nixos", "git", "unknown"}
# 1. Code-scoped stamp — authoritative, immune to shared $HERMES_HOME.
@@ -549,6 +553,8 @@ def recommended_update_command_for_method(method: str) -> str:
if method == "docker":
return "docker pull nousresearch/hermes-agent:latest"
if method == "apt":
+ # By contract, the current "apt" install method is the Termux APT
+ # distribution. It deliberately uses Termux's `pkg` frontend.
return "pkg upgrade hermes-agent"
return "hermes update"
diff --git a/hermes_cli/doctor.py b/hermes_cli/doctor.py
index e12c9605aa6..a75c9c6c00f 100644
--- a/hermes_cli/doctor.py
+++ b/hermes_cli/doctor.py
@@ -90,7 +90,10 @@ def _sqlite_upgrade_hint(install_method: str | None = None) -> str:
if method == "docker":
command = recommended_update_command_for_method(method)
action = f"run `{command}`, then recreate all Hermes containers"
- elif method in {"nix", "nixos", "apt"}:
+ elif method in {"nix", "nixos"}:
+ # The Nix helper is prose guidance, not a literal shell command.
+ action = recommended_update_command_for_method(method)
+ elif method == "apt":
action = f"run `{recommended_update_command_for_method(method)}`"
else:
action = "run `hermes update`"
diff --git a/tests/hermes_cli/test_doctor.py b/tests/hermes_cli/test_doctor.py
index 2e0596ba774..3abf99697d6 100644
--- a/tests/hermes_cli/test_doctor.py
+++ b/tests/hermes_cli/test_doctor.py
@@ -45,6 +45,14 @@ class TestDoctorPlatformHints:
assert "run `pkg upgrade hermes-agent`" in hint
assert "hermes update" not in hint
+ def test_sqlite_upgrade_hint_preserves_nix_guidance_as_prose(self):
+ guidance = doctor.recommended_update_command_for_method("nix")
+ hint = doctor._sqlite_upgrade_hint("nix")
+
+ assert guidance in hint
+ assert f"run `{guidance}`" not in hint
+ assert "hermes update" not in hint
+
class TestProviderEnvDetection:
def test_detects_openai_api_key(self):