The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(checkpoints): reuse _store_has_head in the footprint notice
kshitijk4poorb406d25f2446
diff --git a/tests/tools/test_checkpoint_footprint_notice.py b/tests/tools/test_checkpoint_footprint_notice.pyindex 9b9cadb7cef..647f0abe016 100644--- a/tests/tools/test_checkpoint_footprint_notice.py+++ b/tests/tools/test_checkpoint_footprint_notice.py@@ -35,7 +35,7 @@ def test_notice_only_when_enabled_and_over_cap(tmp_path, monkeypatch):monkeypatch.setattr("tools.checkpoint_maintenance._run_git", unexpected_git)notice = checkpoint_footprint_notice()assert notice- assert "1 project(s)" in notice+ assert "across 1 project(s)" in notice_write_config(enabled=True, cap_mb=500) # under the cap: no nag for a healthy storeassert checkpoint_footprint_notice() is Nonediff --git a/tools/checkpoint_maintenance.py b/tools/checkpoint_maintenance.pyindex 216f8ec6b4f..575c1dc183f 100644--- a/tools/checkpoint_maintenance.py+++ b/tools/checkpoint_maintenance.py@@ -11,7 +11,8 @@ from utils import rmtree_readonlyfrom tools.checkpoint_manager import (_GIT_TIMEOUT, _LEGACY_PREFIX, _PRUNE_MARKER_NAME, _REFS_PREFIX, _STORE_DIRNAME,_dir_size_bytes, _index_path, _list_projects, _pre_v2_shadow_repos,- _project_meta_path, _ref_name, _resolve_checkpoint_base, _run_git, _store_path,+ _project_meta_path, _ref_name, _resolve_checkpoint_base, _run_git, _store_has_head,+ _store_path,)logger = logging.getLogger(__name__)@@ -461,7 +462,7 @@ def checkpoint_footprint_notice() -> Optional[str]:return None# The notice needs no commit counts: full status runs Git for every project.store = _store_path(base)- project_count = len(_list_projects(store)) if (store / "HEAD").exists() else 0+ project_count = len(_list_projects(store)) if _store_has_head(store) else 0from hermes_cli.sizefmt import format_bytesreturn (f"Filesystem checkpoints (/rollback) are on: {format_bytes(size)} across "f"{project_count} project(s), above the {cap_mb} MB cap (one snapshot per project is "