Repository navigation
v0.5.1 — memory remove no longer wipes a whole theme
Upgrade promptly — this fixes a data-loss bug
memory remove deleted every mirrored entry for a theme, not one.
_worker passed old_text=item.content for a remove. But the built-in tool's remove op carries its target in old_text and leaves content empty (tools/memory_tool.py — remove requires old_text), and the host forwards it through metadata, not content. So item.content was always "", store.remove built content LIKE '%%', and that matches every row — one memory remove wiped the entire mirror for that (agent_identity, target).
Verified against Postgres: DELETE … WHERE c LIKE '%%' removes all rows. Checked the reference deployment for damage — none; every theme's history is continuous, so removes are evidently rare in practice.
Fixed at two layers, because one is not enough for a silent full-scope delete:
_workerreadsextra["old_text"]and refuses a remove with no usable targetstore.remove()rejects an empty pattern outright, so the destructive delete is unreachable by omission from any callerremove()now deletes at most one row (lowest id), matching the built-in — which requires a unique match and errors on ambiguity — and this class's ownreplace()
The built-in store was never affected; only the pgvector mirror.
Also fixed
- Empty-content rows are no longer created or retried forever. Nothing rejected empty
add/replace, so a row could exist thatembed()can never process (EmbeddingError("empty input")is unconditional for blank text). The nightly backfill then re-tried it on every run, pinningfailedabove zero and makingremaining == 0unreachable — destroying the one signal an operator watches, since a permanently-stuck row became indistinguishable from a new genuine failure. Empty writes are now skipped (removeexempt), and un-embeddable rows are excluded from the sweep and reported asunembeddable, soremainingcan reach zero again. - The whitespace predicate matches Python. Postgres
trim()strips spaces only, so a row holding just a newline or tab still slipped through and still failed forever. All sites now usecontent ~ '\S'. - Those predicates are raw strings. As plain f-strings,
\Sis an invalid Python escape — fourDeprecationWarnings today,SyntaxWarningon 3.12+, and under-W errorthe module fails to import, which would make hermes-agent's loader silently fall back to built-in memory. Both reproduced and fixed. hermes-pgvector statsreports backfillable and un-embeddable counts separately; the fail-soft backfill path returns theunembeddablekey its contract promises.
Validation
118 tests skip-mode, 164 against live Postgres 16 + pgvector 0.8.6 with all four migrations applied. Two review passes: the first found the data-loss bug, the second found the broken escape sequence in that fix. Attached artifacts are sha256-identical to the PyPI files.
Full changelog: v0.5.0...v0.5.1