Skip to content

The agent that grows with you

fix(backup): exclude Browser Use CLI browser_profiles from archives

686f6c61b52bd5c8570b
diff --git a/hermes_cli/backup.py b/hermes_cli/backup.py
index fd8f53dcdb2..de51366afd1 100644
--- a/hermes_cli/backup.py
+++ b/hermes_cli/backup.py
@@ -63,6 +63,9 @@ _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.
diff --git a/tests/hermes_cli/test_backup.py b/tests/hermes_cli/test_backup.py
index fe31dfac7e4..b50e6f1d32f 100644
--- a/tests/hermes_cli/test_backup.py
+++ b/tests/hermes_cli/test_backup.py
@@ -183,6 +183,23 @@ class TestShouldExclude:
assert not _should_exclude(Path("profiles/sage/cache/citations/ledger.json"))
assert not _should_exclude(Path("skills/example/cache/notes.md"))
+ 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
+ assert _should_exclude(Path("browser_profiles/browser-use-default/Default/Login Data"))
+ assert _should_exclude(
+ Path("browser_profiles/browser-use-default/Default/Network/Cookies")
+ )
+ assert _should_exclude(
+ Path("profiles/coder/browser_profiles/browser-use-default/Default/Cookies")
+ )
+ # Hyphen forms stay excluded.
+ assert _should_exclude(Path("browser-profile/chrome/Default/Cookies"))
+ assert _should_exclude(Path("browser-profiles/Default/Cookies"))
+
def test_keeps_nested_dirs_named_like_runtime_trees(self):
"""A deeper directory that happens to be called models/ or node/ is
user data (a skill's assets, project files) and must survive."""
diff --git a/tests/tools/test_browser_real_profile.py b/tests/tools/test_browser_real_profile.py
index ae8a9d956ba..74f10851f73 100644
--- a/tests/tools/test_browser_real_profile.py
+++ b/tests/tools/test_browser_real_profile.py
@@ -636,11 +636,17 @@ class TestSnapshotIsCredentialStore:
def test_excluded_from_backup(self):
import hermes_cli.backup as bk
- # Exact-component match (both singular and plural browser dirs).
+ # Exact-component match (hyphen snapshot dirs and the Browser Use CLI underscore dir).
assert "browser-profile" in bk._EXCLUDED_DIRS
+ assert "browser_profiles" in bk._EXCLUDED_DIRS
assert bk._should_exclude(
__import__("pathlib").Path("browser-profile/chrome/Default/Cookies")
)
+ assert bk._should_exclude(
+ __import__("pathlib").Path(
+ "browser_profiles/browser-use-default/Default/Login Data"
+ )
+ )
def test_read_guard_blocks_snapshot(self, tmp_path, monkeypatch):
import agent.file_safety as fs