The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(update): only migrate the maintenance.auto=false Hermes itself wrote
ethernetddebc788f2c1
diff --git a/hermes_cli/gitlock.py b/hermes_cli/gitlock.pyindex 00ec3143c80..57d958cb43c 100644--- a/hermes_cli/gitlock.py+++ b/hermes_cli/gitlock.py@@ -185,10 +185,20 @@ def _restore_auto_maintenance(repo_root: Path) -> None:"""Undo the ``maintenance.auto=false`` an earlier cut of _TREE0_MAINTENANCE_OFF persisted.It also switched off git's own post-fetch fold (git <= 2.53), so packs piled up until the next- update. The install checkout is Hermes-owned; only the exact value it wrote is removed.+ update. Nothing records who wrote a lone ``maintenance.auto=false``, so it is removed only+ with the old cut's fingerprint: its sibling keys present and ``maintenance.commit-graph.enabled``+ not yet written. The first pass of disable_tree0_auto_maintenance writes that key, which makes+ this a one-time migration; an operator's own setting is never touched, before or after."""try:- if _git_stdout_lines(repo_root, ["config", "--local", "--get", "maintenance.auto"]) == ["false"]:+ local = dict(line.split(None, 1) for line in _git_stdout_lines(repo_root, [+ "config", "--local", "--get-regexp",+ r"^(maintenance\.auto|maintenance\.commit-graph\.enabled|gc\.writecommitgraph|fetch\.writecommitgraph)$"]))+ old_cut = (local.get("maintenance.auto") == "false"+ and local.get("gc.writecommitgraph") == "false"+ and local.get("fetch.writecommitgraph") == "false"+ and "maintenance.commit-graph.enabled" not in local)+ if old_cut:subprocess.run(["git", "config", "--local", "--unset", "maintenance.auto"],cwd=str(repo_root), check=True, capture_output=True, timeout=30,diff --git a/tests/hermes_cli/test_gitlock.py b/tests/hermes_cli/test_gitlock.pyindex ed7706fa074..527a13e8ad3 100644--- a/tests/hermes_cli/test_gitlock.py+++ b/tests/hermes_cli/test_gitlock.py@@ -298,7 +298,9 @@ def test_maintenance_keys_leave_gits_own_fold_running(tmp_path: Path) -> None:for key, value in (("gc.autoPackLimit", "2"), ("gc.autoDetach", "false"), ("maintenance.autoDetach", "false")):_run_git("config", key, value, cwd=clone) # git's own auto gc, in the foregroundif keys:- _run_git("config", "maintenance.auto", "false", cwd=clone) # what the first cut persisted+ # what the first cut persisted: all three keys together, none of the new one+ for key in ("maintenance.auto", "gc.writeCommitGraph", "fetch.writeCommitGraph"):+ _run_git("config", key, "false", cwd=clone)disable_tree0_auto_maintenance(clone)for path in ("d0/f.txt", "d1/f.txt", "d2/f.txt"):_run_git("cat-file", "-p", _run_git("rev-parse", f"HEAD:{path}", cwd=clone), cwd=clone)@@ -307,6 +309,15 @@ def test_maintenance_keys_leave_gits_own_fold_running(tmp_path: Path) -> None:assert lazy_packs("keys", keys=True) <= lazy_packs("stock", keys=False)+def test_an_operators_own_maintenance_auto_false_is_never_erased(repo: Path) -> None:+ _run_git("config", "maintenance.auto", "false", cwd=repo)++ disable_tree0_auto_maintenance(repo)+ disable_tree0_auto_maintenance(repo)++ assert _run_git("config", "--local", "--get", "maintenance.auto", cwd=repo) == "false"++def test_non_partial_checkout_is_left_alone(repo: Path) -> None:assert consolidate_lazy_fetch_packs(repo) == 0keys = subprocess.run(["git", "config", "--local", "--get-regexp", "maintenance|writecommitgraph"], cwd=repo,