The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(backup): scope browser_profiles exclude to profile-home roots
686f6c6177657e75f5fd
diff --git a/hermes_cli/backup.py b/hermes_cli/backup.pyindex de51366afd1..d344eb3c2cf 100644--- a/hermes_cli/backup.py+++ b/hermes_cli/backup.py@@ -63,9 +63,6 @@ _EXCLUDED_DIRS = {# Real-profile browsing snapshot (browser.use_real_profile): copies of the user's Cookies /# Login Data — a credential store that must NOT enter an archive. Regenerated on next launch."browser-profile",- # Browser Use CLI profile dir (browser.backend: browser-use): same credential store,- # underscore spelling. The hyphen forms above do not match this path.- "browser_profiles",# Python dependency trees (plugin / MCP-server venvs) — regenerated by reinstalling.".venv", "venv", "site-packages",# Tool / build caches — all regeneratable.@@ -77,6 +74,11 @@ _EXCLUDED_DIRS = {# is user data._EXCLUDED_ROOT_DIRS = LOCAL_RUNTIME_ROOT_DIRS+# Browser Use CLI profile dir (browser.backend: browser-use): Chromium user-data with Login Data+# / Cookies. Root-scoped like models/ — a skill's own browser_profiles/ is user data. Backup-only:+# do not fold into LOCAL_RUNTIME_ROOT_DIRS (clone-all identity contract).+_EXCLUDED_BACKUP_ROOT_DIRS = frozenset({"browser_profiles"})+# ``cache/`` at those same roots mixes regenerable state (model/plugin catalogs, stamps, browser# profiles with locked SQLite, tool-output spill) with durable artifacts nothing can rebuild: media# the gateway delivered to or received from the user (``gateway.platforms.base``'s media-delivery@@ -91,7 +93,7 @@ def _in_excluded_root_dir(rel_path: Path) -> bool:parts = parts[2:]if not parts:return False- if parts[0] in _EXCLUDED_ROOT_DIRS:+ if parts[0] in _EXCLUDED_ROOT_DIRS or parts[0] in _EXCLUDED_BACKUP_ROOT_DIRS:return Truereturn parts[0] == "cache" and len(parts) >= 2 and parts[1] not in _KEPT_CACHE_SUBDIRSdiff --git a/tests/hermes_cli/test_backup.py b/tests/hermes_cli/test_backup.pyindex b50e6f1d32f..b5e144b7159 100644--- a/tests/hermes_cli/test_backup.py+++ b/tests/hermes_cli/test_backup.py@@ -185,10 +185,17 @@ class TestShouldExclude:def test_excludes_browser_use_cli_profiles(self):"""Browser Use CLI writes HERMES_HOME/browser_profiles/ (underscore).- Hyphen spellings are already excluded; the underscore dir holds Login Data- and Cookies and must not enter the archive."""- from hermes_cli.backup import _EXCLUDED_DIRS, _should_exclude- assert "browser_profiles" in _EXCLUDED_DIRS+ Match at profile-home roots only; a skill's same-named dir is user data."""+ from hermes_cli.backup import (+ LOCAL_RUNTIME_ROOT_DIRS,+ _EXCLUDED_BACKUP_ROOT_DIRS,+ _EXCLUDED_DIRS,+ _EXCLUDED_ROOT_DIRS,+ _should_exclude,+ )+ assert "browser_profiles" not in _EXCLUDED_DIRS+ assert "browser_profiles" in _EXCLUDED_BACKUP_ROOT_DIRS+ assert _EXCLUDED_ROOT_DIRS is LOCAL_RUNTIME_ROOT_DIRSassert _should_exclude(Path("browser_profiles/browser-use-default/Default/Login Data"))assert _should_exclude(Path("browser_profiles/browser-use-default/Default/Network/Cookies")@@ -196,7 +203,8 @@ class TestShouldExclude:assert _should_exclude(Path("profiles/coder/browser_profiles/browser-use-default/Default/Cookies"))- # Hyphen forms stay excluded.+ assert not _should_exclude(Path("skills/example/browser_profiles/notes.md"))+ # Hyphen forms stay any-depth (pre-existing).assert _should_exclude(Path("browser-profile/chrome/Default/Cookies"))assert _should_exclude(Path("browser-profiles/Default/Cookies"))diff --git a/tests/tools/test_browser_real_profile.py b/tests/tools/test_browser_real_profile.pyindex 74f10851f73..ff43b96906a 100644--- a/tests/tools/test_browser_real_profile.py+++ b/tests/tools/test_browser_real_profile.py@@ -636,9 +636,9 @@ class TestSnapshotIsCredentialStore:def test_excluded_from_backup(self):import hermes_cli.backup as bk- # Exact-component match (hyphen snapshot dirs and the Browser Use CLI underscore dir).+ # Hyphen snapshot dirs are any-depth; Browser Use CLI underscore dir is root-scoped.assert "browser-profile" in bk._EXCLUDED_DIRS- assert "browser_profiles" in bk._EXCLUDED_DIRS+ assert "browser_profiles" in bk._EXCLUDED_BACKUP_ROOT_DIRSassert bk._should_exclude(__import__("pathlib").Path("browser-profile/chrome/Default/Cookies"))