Skip to content

The agent that grows with you

docs(sessions): name the reachable ordinal-0 rewind path in the #95868 guards

joaomarcos59993be6e94d
diff --git a/hermes_state.py b/hermes_state.py
index 0c5a0398d34..4297189120d 100644
--- a/hermes_state.py
+++ b/hermes_state.py
@@ -13183,11 +13183,12 @@ class SessionDB(SessionSearchMixin, SessionSchemaMixin, SessionPortabilityMixin)
#: keeping the dropped turns on disk as ``active = 0``:
#: :meth:`replace_messages` with ``archive_dropped=True`` (the rewind /
#: edit / regenerate mode from #82756) and :meth:`archive_and_compact`
- #: (in-place compaction). A chat rewound to its first turn, or compacted
- #: with an empty live set, therefore reports ``message_count = 0`` while
- #: still holding its entire recoverable transcript — and those
- #: soft-archived rows are the ONLY copy, which is the whole point of
- #: archiving instead of deleting. Deleting such a row destroys it silently.
+ #: (in-place compaction). ``prompt.submit`` reaches the first with an empty
+ #: prefix on a confirmed ordinal-0 rewind, so a chat whose first user turn
+ #: was regenerated reports ``message_count = 0`` while still holding its
+ #: entire recoverable transcript — and those soft-archived rows are the
+ #: ONLY copy, which is the whole point of archiving instead of deleting
+ #: (#70516 / #80763 / #82756). Deleting such a row destroys it silently.
#:
#: So the counter stays as a cheap prefilter and a real ``EXISTS`` probe is
#: the authority, exactly as every other emptiness test in this module
diff --git a/tests/hermes_state/test_empty_sweep_archived_transcript_95868.py b/tests/hermes_state/test_empty_sweep_archived_transcript_95868.py
index b88cf96a84b..2f1775a678c 100644
--- a/tests/hermes_state/test_empty_sweep_archived_transcript_95868.py
+++ b/tests/hermes_state/test_empty_sweep_archived_transcript_95868.py
@@ -10,13 +10,18 @@ keeping every dropped turn on disk as ``active = 0``:
* ``replace_messages(..., archive_dropped=True)`` — the rewind / edit /
regenerate mode added in #82756 precisely so a user can take a turn back
- without the rows being unrecoverable.
+ without the rows being unrecoverable. ``prompt.submit`` reaches it with an
+ empty prefix on a confirmed ordinal-0 rewind (regenerating the very first
+ user turn), which is the reachable production shape.
* ``archive_and_compact`` — in-place compaction, which archives the
- pre-compaction transcript under the same session id (#38763).
-
-Rewind a chat back to its first turn, or compact it with an empty live set,
-and the row reports ``message_count = 0`` while still holding its entire
-recoverable history. Those soft-archived rows are the ONLY copy.
+ pre-compaction transcript under the same session id (#38763). It normally
+ publishes at least a summary row, so it lands on the same shape only when
+ the live set comes back empty; pinned here as defense in depth.
+
+Either way the row reports ``message_count = 0`` while still holding its
+entire recoverable history, and those soft-archived rows are the ONLY copy —
+which is the whole point of the archive-instead-of-delete guarantee that
+#70516 / #80763 / #82756 were fixed to provide.
A gateway reload is what makes such a row *eligible*: every detached session
gets ``ended_at`` stamped (``end_reason='ws_orphan_reap'``), which satisfies