Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions hermes_cli/web_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -11199,9 +11199,17 @@ def _import_sessions_for_profile(profile: Optional[str], sessions: List[Dict[str
# the dashboard read paths query. Reads at most one row per table. Read-only
# opens skip _reconcile_columns(), so an older store would otherwise 500 on
# every poll until something opened it writable.
#
# MAINTENANCE: any new column added to hermes_state_common.py's sessions/
# messages schema that a dashboard read path (list_sessions_rich et al.)
# queries must be added here too, or an existing pre-feature database will
# 500 on GET /api/sessions until a write connection happens to open first
# (e.g. creating a new session) -- issue #80037, where last_read_at was
# never added to this list when the read-state feature shipped.
_SESSION_DB_READ_PROBE_SQL = (
"SELECT (SELECT archived FROM sessions LIMIT 1), "
"(SELECT pinned FROM sessions LIMIT 1), "
"(SELECT last_read_at FROM sessions LIMIT 1), "
"(SELECT active FROM messages LIMIT 1), "
"(SELECT compacted FROM messages LIMIT 1)"
)
Expand Down
2 changes: 1 addition & 1 deletion tests/hermes_cli/test_web_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ def test_get_sessions_fresh_store_returns_empty_list(self):
assert response.json()["sessions"] == []
assert response.json()["total"] == 0

@pytest.mark.parametrize("missing_column", ["archived", "pinned"])
@pytest.mark.parametrize("missing_column", ["archived", "pinned", "last_read_at"])
def test_get_sessions_heals_stale_schema_store(self, missing_column):
import sqlite3

Expand Down
Loading