The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(state): make the quarantine-guard test exercise the guard
kshitijk4poorc3bcd208995f
diff --git a/hermes_state_schema.py b/hermes_state_schema.pyindex 58daf0ea955..f25e04afd8d 100644--- a/hermes_state_schema.py+++ b/hermes_state_schema.py@@ -682,24 +682,12 @@ class SessionSchemaMixin:if not getattr(self, "_fts_stale", False):return Falseif getattr(self, "_db_corrupt", False):- # Quarantined: structural corruption was already observed on- # this handle, so the only safe policy is to stop touching the- # file (mirrors hermes_state.py's _try_wal_checkpoint). A full- # FTS rebuild is real DDL/DML against the same damaged image —- # exactly what quarantine exists to prevent — and this method- # is called unconditionally every housekeeping tick for the- # life of a long-running gateway process, so a stale-FTS flag- # left set on a now-corrupt handle would otherwise retry the- # rebuild forever.- #- # Reset the backoff bookkeeping too (mirrors the success path's- # own reset a few lines down): no code path today clears- # _db_corrupt on a live handle, so this is inert in practice,- # but leaving a doubled _fts_stale_retry_interval sitting behind- # a flag nothing currently clears is a footgun for whoever adds- # an un-quarantine/recovery path later — the next real retry- # should start from the default backoff, not wherever this- # handle's interval happened to be when it was quarantined.+ # Quarantined: never run FTS DDL/DML against a damaged image+ # (mirrors _try_wal_checkpoint / close). This runs every+ # housekeeping tick for the life of a gateway process, so a stale+ # flag on a corrupt handle would otherwise retry the rebuild+ # forever. Reset the backoff so any future un-quarantine path+ # starts from the default interval, not a doubled stale one.self._fts_stale_retry_after = 0.0self._fts_stale_retry_interval = 0.0return Falsediff --git a/tests/state/test_fts_rebuild_admission.py b/tests/state/test_fts_rebuild_admission.pyindex 7af9330d6e1..cac3ef1690f 100644--- a/tests/state/test_fts_rebuild_admission.py+++ b/tests/state/test_fts_rebuild_admission.py@@ -648,9 +648,12 @@ class TestDeferredFtsRetryInProcess:assert gw._fts_stale is Truegw._db_corrupt = Truegw._db_corrupt_reason = "database disk image is malformed"- # Simulate a handle that had already been backing off for a- # while before it tripped quarantine.- gw._fts_stale_retry_after = time.monotonic() + 900.0+ # A retry that is DUE (backoff already elapsed) on a handle that+ # had been backing off before it tripped quarantine. Seeding the+ # deadline in the past matters: a future deadline would make the+ # unguarded code short-circuit on the backoff check and this test+ # would pass without the quarantine guard ever being exercised.+ gw._fts_stale_retry_after = time.monotonic() - 1.0gw._fts_stale_retry_interval = 900.0assert gw.retry_deferred_fts_recovery() is False# Untouched: still marked stale, triggers still absent — no