The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(search): simulate the real chain-walk bound in the deep-lineage fake
Brooklyn Nicholson55412951c5e6
diff --git a/hermes_state_compression.py b/hermes_state_compression.pyindex 5523e9ed1f5..b1de55cb92e 100644--- a/hermes_state_compression.py+++ b/hermes_state_compression.py@@ -75,6 +75,12 @@ def _claim_lease_row(conn, table: str, key_col: str, key: str, holder: str, now:return owner is not None and owner["holder"] == holder, reclaimed_holder+# Defensive bound on the forward compression-chain walk; ``seen`` guards cycles.+# 100 truncated real compression lineages (~180 deep), stranding root→tip walks+# on a stale mid id (#125041). Named so tests can simulate the REAL walk.+_CHAIN_CAP = 1000++class SessionCompressionMixin:"""Compression lineage, cooldown/streak counters, locks and turn leases."""@@ -725,7 +731,7 @@ class SessionCompressionMixin:# Defensive bound; ``seen`` guards cycles. 100 truncated real# compression lineages (~180 deep), stranding root→tip walks on a# stale mid id (#125041).- for _ in range(1000):+ for _ in range(_CHAIN_CAP):with self._read_ctx() as conn:row = conn.execute(_CHAIN_STEP_SQL, (current,)).fetchone()child_id = row["id"] if row is not None else Nonediff --git a/tests/hermes_cli/test_web_server_session_search.py b/tests/hermes_cli/test_web_server_session_search.pyindex 96df1dad09a..3c83182b541 100644--- a/tests/hermes_cli/test_web_server_session_search.py+++ b/tests/hermes_cli/test_web_server_session_search.py@@ -239,12 +239,16 @@ class _DeepLineageSessionDB(_FakeSessionDB):"ended_at": n + 1, "started_at": n}def get_compression_tip(self, session_id):- # Faithful simulation of the bounded forward walk from ANY start id:- # root→tip hops are capped, matched-id→tip hops are not (the walk- # terminates at the real tip when started near it).- cap = 1000 # the raised bound; the OLD bound (100) truncated root walks+ # Faithful simulation of the REAL bounded forward walk in+ # SessionDB.get_compression_chain: at most _CHAIN_CAP hops from the+ # START id, so a lineage deeper than the cap truncates when the walk+ # starts far from the tip. Resolving from the MATCHED id keeps the+ # remaining distance under the cap; the raised bound lets even a+ # root-started walk terminate at the live tip (#125041).+ from hermes_state_compression import _CHAIN_CAP+idx = int(session_id[1:])- return f"s{min(idx + cap, self.DEPTH - 1):03d}"+ return f"s{min(idx + _CHAIN_CAP, self.DEPTH - 1):03d}"def test_deep_lineage_search_resolves_tip_from_matched_id(monkeypatch):