The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix: state the real failure mode of the model_config sanitiser
teknium1a5d561b1ea82
diff --git a/hermes_cli/session_recovery.py b/hermes_cli/session_recovery.pyindex ef4a8b58436..467be841131 100644--- a/hermes_cli/session_recovery.py+++ b/hermes_cli/session_recovery.py@@ -912,10 +912,14 @@ def _sanitize_session_model_config(destination: sqlite3.Connection) -> int:"""Rewrite unparseable ``sessions.model_config`` blobs to ``'{}'``; returns the row count.``integrity_check`` validates b-tree structure, never column *contents*: a row whose- JSON was truncated by the damage verifies clean and then makes every ``json_extract``- reader (``hermes sessions list``, the dashboard chain CTE) raise on the recovered- database. The blob is unrecoverable either way, so neutralise it at the copy boundary- both lanes pass through rather than shipping a store that cannot be listed.+ JSON was truncated by the damage verifies clean, and the recovered store then raises+ ``OperationalError: malformed JSON`` the first time ``reopen_session`` rewrites the+ reset-child markers with ``json_set`` (``hermes_state_sessions.py::reopen_session``) —+ i.e. on the first resume of a parent session. Read paths are already guarded+ (``_sql_json_extract`` wraps every extract in ``CASE WHEN json_valid``), so this is+ about the write path. The blob is unrecoverable either way, so neutralise it at the+ copy boundary both lanes pass through rather than shipping a store that breaks on+ the first resume."""if "model_config" not in _table_columns(destination, "sessions"):return 0diff --git a/tests/hermes_cli/test_session_recovery_model_config.py b/tests/hermes_cli/test_session_recovery_model_config.pyindex 2e3472fabca..fb7100220e5 100644--- a/tests/hermes_cli/test_session_recovery_model_config.py+++ b/tests/hermes_cli/test_session_recovery_model_config.py@@ -48,10 +48,8 @@ def test_recovery_resets_unparseable_model_config(tmp_path):recovered = SessionDB(db_path=output)try:- # The blob was unrecoverable; what matters is that the store still works.- row = recovered.get_session("child")- assert row is not None and row["model_config"] == "{}"+ # The blob was unrecoverable; what matters is that resuming the parent still works+ # (on base this raises OperationalError: malformed JSON).recovered.reopen_session("parent")finally:recovered.close()- assert report["derived_metadata"]["model_config_reset"] == 1