The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(checkpoints): avoid history queries in the footprint notice
Hygaarde5d94d953757
diff --git a/tests/tools/test_checkpoint_footprint_notice.py b/tests/tools/test_checkpoint_footprint_notice.pyindex 4222e28aa36..9b9cadb7cef 100644--- a/tests/tools/test_checkpoint_footprint_notice.py+++ b/tests/tools/test_checkpoint_footprint_notice.py@@ -29,8 +29,13 @@ def test_notice_only_when_enabled_and_over_cap(tmp_path, monkeypatch):_write_config(enabled=True, cap_mb=1)assert CheckpointManager(enabled=True, max_total_size_mb=1).ensure_checkpoint(str(work), "seed")+ def unexpected_git(*args, **kwargs):+ raise AssertionError("A storage notice must not inspect commit history")++ monkeypatch.setattr("tools.checkpoint_maintenance._run_git", unexpected_git)notice = checkpoint_footprint_notice()assert notice+ assert "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 b0e9a28ff05..216f8ec6b4f 100644--- a/tools/checkpoint_maintenance.py+++ b/tools/checkpoint_maintenance.py@@ -453,13 +453,18 @@ def checkpoint_footprint_notice() -> Optional[str]:if not cfg.get("enabled", False):return Nonecap_mb = int(cfg.get("max_total_size_mb", 500) or 0)- status = store_status()- size = int(status["total_size_bytes"])- if cap_mb <= 0 or size < cap_mb * 1024 * 1024:+ if cap_mb <= 0:return None+ base = _resolve_checkpoint_base()+ size = _dir_size_bytes(base)+ if size < cap_mb * 1024 * 1024:+ 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 0from hermes_cli.sizefmt import format_bytesreturn (f"Filesystem checkpoints (/rollback) are on: {format_bytes(size)} across "- f"{status['project_count']} project(s), above the {cap_mb} MB cap (one snapshot per project is "+ f"{project_count} project(s), above the {cap_mb} MB cap (one snapshot per project is "f"always kept). Not using /rollback? `hermes config set checkpoints.enabled false` then "f"`hermes checkpoints clear`; or lower `checkpoints.retention_days`.")except Exception as exc: