The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(profiles): --clone-all skips the local-models runtime trees (models/, runtimes/, node/)
John Paul Solivaf11be8979caa
diff --git a/hermes_cli/profiles.py b/hermes_cli/profiles.pyindex d685e9b5ff3..9e6730d4cd7 100644--- a/hermes_cli/profiles.py+++ b/hermes_cli/profiles.py@@ -40,11 +40,16 @@ _CLONE_ALL_STRIP: list[str] = ["gateway.pid", "gateway_state.json", "processes.j# Infrastructure excluded from --clone-all ONLY when the source is the default profile# (``~/.hermes``): git checkout (+ ~3 GB venv), worktrees, sibling profiles, shared bins,-# npm packages. Named profiles never hold these at root, so the gate avoids silently-# dropping user data from a named-profile source. Export uses a root allow-list instead-# (``_DEFAULT_EXPORT_INCLUDE_ROOT``): an archive is a portable snapshot, a clone must run.+# npm packages, and the managed local-models trees — GGUF weights (tens of GB), the+# llama.cpp runtime binaries and the managed Node install, all re-downloadable on demand+# and resolved from the default root only. Named profiles never hold these at root, so the+# gate avoids silently dropping user data from a named-profile source. Export uses a root+# allow-list instead (``_DEFAULT_EXPORT_INCLUDE_ROOT``): an archive is a portable snapshot,+# a clone must run. The last three mirror ``hermes_cli.backup._EXCLUDED_ROOT_DIRS`` — kept+# as separate literals because importing it here would be circular; change both together._CLONE_ALL_DEFAULT_EXCLUDE_ROOT: frozenset[str] = frozenset({"hermes-agent", ".worktrees", "profiles", "bin", "node_modules",+ "models", "runtimes", "node",})# Per-profile history excluded from --clone-all for ANY source: SQLite session storediff --git a/tests/hermes_cli/test_profiles.py b/tests/hermes_cli/test_profiles.pyindex 605e68a6d1b..01349db93b5 100644--- a/tests/hermes_cli/test_profiles.py+++ b/tests/hermes_cli/test_profiles.py@@ -20,6 +20,7 @@ import yamlfrom hermes_cli import profilesfrom hermes_cli.profiles import (+ _clone_all_copytree_ignore,normalize_profile_name,validate_profile_name,get_profile_dir,@@ -1263,3 +1264,59 @@ class TestResolveProfileEnvSpelling:assert Path(resolve_profile_env("default")) == _get_default_hermes_home()+# ===================================================================+# TestCloneAllExcludesRuntimeTrees+# ===================================================================++class TestCloneAllExcludesRuntimeTrees:+ """``--clone-all`` from the default profile must not copy the machine-scoped+ runtime trees the local-models flow puts under ``~/.hermes``: ``models/``+ (GGUF weights, tens of GB), ``runtimes/`` (llama.cpp binaries) and ``node/``+ (managed Node). ``backup.py`` already excludes exactly these; the clone-all+ ignore list had not followed.+ """++ RUNTIME_TREES = ("models", "runtimes", "node")++ def _seed(self, home):+ (home / "models").mkdir(); (home / "models" / "big.gguf").write_bytes(b"\0" * 64)+ (home / "runtimes" / "llamacpp" / "bin").mkdir(parents=True)+ (home / "runtimes" / "llamacpp" / "bin" / "llama-server").write_text("bin")+ (home / "node" / "bin").mkdir(parents=True)+ (home / "node" / "bin" / "node").write_text("bin")+ (home / "skills" / "greet").mkdir(parents=True)+ (home / "skills" / "greet" / "SKILL.md").write_text("# greet\n")+ (home / "config.yaml").write_text("model: test\n")++ def test_ignore_drops_runtime_trees_only_at_the_default_root(self, profile_env):+ default_home = profile_env / ".hermes"+ self._seed(default_home)+ # a skill that happens to carry a nested models/ dir is user data+ (default_home / "skills" / "greet" / "models").mkdir()+ ignore = _clone_all_copytree_ignore(default_home)++ at_root = ignore(str(default_home), ["models", "runtimes", "node", "skills", "config.yaml"])+ nested = ignore(str(default_home / "skills" / "greet"), ["models", "SKILL.md"])++ assert set(at_root) == set(self.RUNTIME_TREES)+ assert nested == []++ def test_named_profile_source_keeps_its_own_runtime_dirs(self, profile_env):+ # The exclusion is gated on the default profile: a named profile that+ # really has a models/ dir of its own must not have it dropped.+ source = create_profile("source", no_alias=True)+ (source / "models").mkdir()+ ignore = _clone_all_copytree_ignore(source)++ assert ignore(str(source), ["models", "runtimes", "node", "SOUL.md"]) == []++ def test_clone_all_from_default_skips_runtime_trees_but_keeps_the_rest(self, profile_env):+ default_home = profile_env / ".hermes"+ self._seed(default_home)++ clone = create_profile("clone", clone_all=True, no_alias=True)++ for name in self.RUNTIME_TREES:+ assert not (clone / name).exists(), name+ assert (clone / "skills" / "greet" / "SKILL.md").is_file()+ assert (clone / "config.yaml").is_file()