The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(state): exclude empty ghost sessions from title uniqueness
Abhijat Saxenafb4aac296b97
diff --git a/hermes_state_titles.py b/hermes_state_titles.pyindex a1f9fa2a4cd..581d8259efe 100644--- a/hermes_state_titles.py+++ b/hermes_state_titles.py@@ -112,7 +112,8 @@ class SessionTitlesMixin:return 0if title:conflict = conn.execute(- "SELECT id, archived, hidden FROM sessions WHERE title = ? AND id != ?", (title, session_id),+ "SELECT id, archived, hidden FROM sessions WHERE title = ? AND id != ? AND message_count > 0",+ (title, session_id),).fetchone()if conflict:conflict_id = conflict["id"]diff --git a/tests/hermes_state/test_hermes_state.py b/tests/hermes_state/test_hermes_state.pyindex 78e90e27787..d5505103c2c 100644--- a/tests/hermes_state/test_hermes_state.py+++ b/tests/hermes_state/test_hermes_state.py@@ -1708,7 +1708,30 @@ class TestSessionTitle:session = db.get_session("s1")assert session["title"] is None+ def test_empty_ghost_session_does_not_block_title(self, db):+ """Empty sessions (0 messages) should not block title reuse (#81888).+ Regression test: ghost sessions created by interrupted flows (e.g., desktop+ session creation that never sent a message) would block rename attempts even+ though they were invisible in the UI.+ """+ # Create a ghost session (0 messages) with a title+ ghost_id = db.create_session("ghost", "desktop")+ db.set_session_title(ghost_id, "Canada")+ assert db.get_session(ghost_id)["message_count"] == 0++ # Create a real session with messages+ real_id = db.create_session("real", "desktop")+ db.append_message(real_id, "user", "Hello")+ db.append_message(real_id, "assistant", "Hi there")+ assert db.get_session(real_id)["message_count"] == 2++ # Should be able to rename the real session to "Canada" — ghost doesn't block+ db.set_session_title(real_id, "Canada")+ assert db.get_session(real_id)["title"] == "Canada"++ # Ghost session should still exist but be effectively invisible+ assert db.get_session(ghost_id) is not Noneclass TestSessionTitleIndexRepair: