Skip to content

The agent that grows with you

fix(cli): allow pinned installs to disable passive update checks

Teknium4dcdb5e896fa
diff --git a/cli-config.yaml.example b/cli-config.yaml.example
index c26d3309999..ff16cc3a20c 100644
--- a/cli-config.yaml.example
+++ b/cli-config.yaml.example
@@ -1969,6 +1969,9 @@ telemetry:
# Update Behavior
# =============================================================================
updates:
+ # Disable passive CLI/banner update checks with `hermes config set updates.check false`.
+ # Explicit `hermes update --check` and `hermes update` remain available.
+ check: true
# Create a full HERMES_HOME zip before every `hermes update`.
# Backups land in ~/.hermes/backups/ and can be restored with `hermes import`.
# Off by default because large homes can add minutes to every update.
diff --git a/hermes_cli/banner.py b/hermes_cli/banner.py
index c628e2d780a..4ec9b58ff6b 100644
--- a/hermes_cli/banner.py
+++ b/hermes_cli/banner.py
@@ -327,6 +327,13 @@ def check_for_updates() -> Optional[int]:
If ``HERMES_REVISION`` is set (nix builds embed it), compare it to upstream main via
``git ls-remote``; otherwise count commits behind ``origin/main`` in the local checkout.
"""
+ def _read_config_opt_out():
+ from hermes_cli.config import load_config
+ return load_config().get("updates", {}).get("check", True) is False
+
+ if _quiet(_read_config_opt_out) is True:
+ return None
+
cache_file = get_hermes_home() / ".update_check"
embedded_rev = os.environ.get("HERMES_REVISION") or None
# Docker images have no working tree (the image excludes `.git`) and set no HERMES_REVISION.
diff --git a/hermes_cli/config_defaults.py b/hermes_cli/config_defaults.py
index a5f92214243..eec19e7689d 100644
--- a/hermes_cli/config_defaults.py
+++ b/hermes_cli/config_defaults.py
@@ -2077,6 +2077,8 @@ DEFAULT_CONFIG = {
},
"updates": {
+ # Passive version/banner checks only; explicit `hermes update --check` remains enabled.
+ "check": True,
# Pre-update backup. quick = snapshot small critical state (pairing JSONs, cron jobs,
# config.yaml, .env, auth.json, profile DBs) into <HERMES_HOME>/state-snapshots/, skipping
# files >1 GiB; restore via ``/snapshot``. full = quick PLUS a ``hermes backup`` zip in
diff --git a/tests/hermes_cli/test_passive_update_opt_out.py b/tests/hermes_cli/test_passive_update_opt_out.py
new file mode 100644
index 00000000000..69e01d91ea3
--- /dev/null
+++ b/tests/hermes_cli/test_passive_update_opt_out.py
@@ -0,0 +1,41 @@
+"""Passive opt-out keeps explicit update checks available."""
+import json
+import subprocess
+import time
+
+from hermes_constants import get_hermes_home
+
+
+def test_passive_check_obeys_config_before_using_cached_notice(monkeypatch):
+ from hermes_cli import banner
+
+ home = get_hermes_home()
+ (home / ".update_check").write_text(json.dumps({
+ "ts": time.time(), "behind": 17, "rev": None, "ver": banner.VERSION,
+ }), encoding="utf-8")
+ monkeypatch.delenv("HERMES_REVISION", raising=False)
+ config = home / "config.yaml"
+ config.write_text("updates:\n check: true\n", encoding="utf-8")
+ assert banner.check_for_updates() == 17
+ config.write_text("updates:\n check: false\n", encoding="utf-8")
+ assert banner.check_for_updates() is None
+
+
+def test_explicit_check_fetches_local_origin_despite_passive_opt_out(tmp_path, monkeypatch, capsys):
+ from hermes_cli import main
+ from hermes_cli.update_cmd import _cmd_update_check
+
+ remote = tmp_path / "remote"
+ local = tmp_path / "checkout"
+ def git(*args):
+ return subprocess.run(["git", *map(str, args)], check=True, capture_output=True, text=True)
+ git("init", "-b", "main", remote)
+ git("-C", remote, "-c", "user.name=Fixture", "-c", "[email protected]", "commit", "--allow-empty", "-m", "initial")
+ git("clone", remote, local)
+ git("-C", remote, "-c", "user.name=Fixture", "-c", "[email protected]", "commit", "--allow-empty", "-m", "next")
+ monkeypatch.setattr(main, "PROJECT_ROOT", local)
+ (get_hermes_home() / "config.yaml").write_text("updates:\n check: false\n", encoding="utf-8")
+ _cmd_update_check()
+ output = capsys.readouterr().out
+ assert "Fetching from origin" in output
+ assert "1 commit" in output
diff --git a/website/docs/getting-started/updating.md b/website/docs/getting-started/updating.md
index 136d56d6b81..d70ca052859 100644
--- a/website/docs/getting-started/updating.md
+++ b/website/docs/getting-started/updating.md
@@ -20,6 +20,16 @@ This pulls the latest code from `main`, updates dependencies, and prompts you to
`hermes update` automatically detects new configuration options and prompts you to add them. If you skipped that prompt, you can manually run `hermes config check` to see missing options, then `hermes config migrate` to interactively add them.
:::
+### Passive update notices
+
+Pinned or noninteractive installations can disable passive CLI version and banner update checks:
+
+```bash
+hermes config set updates.check false
+```
+
+This suppresses both cached update notices and passive update-check network requests. The default is `true`. Explicit `hermes update --check` and `hermes update` still work; this setting does not control the Desktop application's updater.
+
### What happens during an update
When you run `hermes update`, the following steps occur: