Skip to content

The agent that grows with you

fix: harden /save for test doubles, async session-store boundary, snapshot shape pin

Tekniume5a2c80c0e79
diff --git a/cli.py b/cli.py
index 4dd7864808a..c174fd8fcb8 100644
--- a/cli.py
+++ b/cli.py
@@ -9374,10 +9374,14 @@ class HermesCLI(CLIAgentSetupMixin, CLICommandsMixin, CLIBillingMixin):
# Prefer the durable DB row (has metadata + tool calls); fall back to
# the in-memory history for sessions that never touched the DB.
+ # getattr: test doubles (SimpleNamespace / object.__new__) may not
+ # carry _session_db or session_id.
session_data = None
- if self._session_db and self.session_id:
+ _db = getattr(self, "_session_db", None)
+ _sid = getattr(self, "session_id", None)
+ if _db and _sid:
try:
- session_data = self._session_db.export_session(self.session_id)
+ session_data = _db.export_session(_sid)
except Exception:
session_data = None
if not session_data:
diff --git a/gateway/slash_commands.py b/gateway/slash_commands.py
index 338e7f1a2fe..0d39589277e 100644
--- a/gateway/slash_commands.py
+++ b/gateway/slash_commands.py
@@ -4543,7 +4543,7 @@ class GatewaySlashCommandsMixin:
)
source = event.source
- session_entry = self.session_store.get_or_create_session(source)
+ session_entry = await self.async_session_store.get_or_create_session(source)
session_id = session_entry.session_id
if not self._session_db:
diff --git a/tests/cli/test_save_conversation_location.py b/tests/cli/test_save_conversation_location.py
index 5e460fe81bc..714ddabddb6 100644
--- a/tests/cli/test_save_conversation_location.py
+++ b/tests/cli/test_save_conversation_location.py
@@ -75,7 +75,9 @@ def test_save_conversation_writes_under_hermes_home(hermes_home, tmp_path, monke
payload = json.loads(files[0].read_text())
assert payload["model"] == "test-model"
- assert payload["session_id"] == "20260101_120000_abc123"
+ # /save now emits the canonical export_session shape: the session id
+ # lives under "id" (was "session_id" in the legacy snapshot format).
+ assert payload["id"] == "20260101_120000_abc123"
assert payload["messages"] == [
{"role": "user", "content": "hi"},
{"role": "assistant", "content": "hello"},