mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-11-17 04:11:35 +00:00
Move retention, orphan pruning, status and clear operations into a topical sibling and route callers and tests directly to their defining module. Keep the shared store paths and git execution in checkpoint_manager; shorten the local child-env WHAT docstring.
31 lines
940 B
Python
31 lines
940 B
Python
"""Checkpoint store pruning rides the gateway housekeeping tick, not the constructor.
|
|
|
|
Its ``git gc`` repacks the whole store (tens of seconds on a GB store); run at construction it
|
|
delayed the control socket, adapters and the code_sha stamp, so the first restart of the day (the
|
|
``hermes update`` one) looked hung and failed fleet verification.
|
|
"""
|
|
|
|
import gateway.run as gateway_run
|
|
|
|
|
|
class _OneTickStopEvent:
|
|
def __init__(self):
|
|
self.waited = False
|
|
|
|
def is_set(self):
|
|
return self.waited
|
|
|
|
def wait(self, timeout=None):
|
|
self.waited = True
|
|
return True
|
|
|
|
|
|
def test_gateway_housekeeping_runs_the_checkpoint_prune(monkeypatch):
|
|
import tools.checkpoint_maintenance as cm
|
|
|
|
calls = []
|
|
monkeypatch.setattr(cm, "auto_prune_from_config", lambda: calls.append(True) or {"skipped": False})
|
|
|
|
gateway_run._start_gateway_housekeeping(_OneTickStopEvent(), interval=0)
|
|
|
|
assert calls == [True]
|