The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(state): hoist guard-error import and fix prune docstring order
kshitijk4poor73a34dd7f13d
diff --git a/hermes_state_gateway.py b/hermes_state_gateway.pyindex 7179eb55d9a..e46fcd56dc5 100644--- a/hermes_state_gateway.py+++ b/hermes_state_gateway.py@@ -15,6 +15,7 @@ from typing import Any, Dict, List, Optional, Set, Tuplefrom hermes_state_common import (_RECOVERABLE_END_REASONS_SQL, _RESET_CHILD_SQL, _RESET_END_REASONS_SQL, _sql_json_extract,_sql_session_last_active)+from hermes_state_errors import SessionActiveWriteGuardError# Log-record parity with the origin module (caplog tests pin "hermes_state").logger = logging.getLogger("hermes_state")@@ -404,7 +405,7 @@ class SessionGatewayMixin:Rows under a live turn lease or compression lock are skipped (#123583): thenever-active predicate reads committed state, so a keyed row whose first turn leaseis already held — its messages not yet flushed — would otherwise be deleted- mid-turn. Each deleted row's routing entry is dropped per row, entry-then-row in+ mid-turn. Each deleted row's routing entry is dropped per row, row-then-entry inthe same failure domain: a stale entry outliving its target would have the gatewayresume a nonexistent id, and an entry deleted ahead of a bulk sweep that lateraborts mid-loop (any non-guard write error propagates out of ``_execute_write``)@@ -413,7 +414,6 @@ class SessionGatewayMixin:if not candidates:return (0, 0)ids = {str(row["id"]) for row in candidates}- from hermes_state_errors import SessionActiveWriteGuardErrordeleted = routing_deleted = 0for sid in ids:try: