fix(dashboard): probe last_read_at in read-only session-store staleness check - #80401
Closed
wangyunyou wants to merge 1 commit into
Closed
fix(dashboard): probe last_read_at in read-only session-store staleness check#80401wangyunyou wants to merge 1 commit into
wangyunyou wants to merge 1 commit into
Conversation
…ss check The read-only stale-schema probe (compiled against the columns the dashboard read paths query) missed last_read_at when it landed in ec0c8d9. Read-only opens skip _reconcile_columns(), so a store missing only that column passes the probe, never heals through the one-time writable open, and 500s on every /api/sessions poll until a CLI/gateway startup opens it writable — profiles used only via desktop/dashboard stay broken indefinitely.
Collaborator
Collaborator
|
Closing as implemented on #80797 (merged, Your diagnosis was right, and it's the fix that landed — just generalized so the probe can't go stale again the next time a column ships. Thanks for chasing it down. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The read-only session-store staleness probe (
_SESSION_DB_READ_PROBE_SQLinhermes_cli/web_server.py) was not updated whenlast_read_atlanded inec0c8d9c2("feat(state): sessions carry read/unread state").Read-only opens skip
_reconcile_columns()(by design), so an older store missing only that column passes the probe —archived/pinned/active/compactedall exist — and never triggers the heal-once writable open. EveryGET /api/sessionspoll then 500s withno such column: s.last_read_atuntil something opens the store writable (CLI/gateway startup). Profiles used only through the desktop/dashboard backend never get that writable open, so their session lists stay broken indefinitely.Reproduction
On a profile whose
state.dbpredatesec0c8d9c2(sessions table withoutlast_read_at):GET /api/sessions→ 500 on every poll (once per ~60s)hermes_cli.web_server: GET /api/sessions failed→sqlite3.OperationalError: no such column: s.last_read_at(traceback inlist_sessions_rich, hermes_state.py:6055)_open_session_db_for_profilenever fires because the probe SQL doesn't reference the missing column, so the store stays read-only foreverObserved on a real install: two profiles (
xuanru,money) created Aug 2 with stores missinglast_read_at; both session lists 500'd from the moment the update landed until a CLI run opened the store writable.Fix
Add
(SELECT last_read_at FROM sessions LIMIT 1)to the probe. A store missing the column now fails the probe, which triggers the existing one-time writable open;_init_schema()→_reconcile_columns()then adds the column declaratively (no version-gated migration needed).Test Plan
scripts/run_tests.sh tests/hermes_cli/test_web_server.py tests/test_web_server_sessiondb_eventloop.py -q→ 142 passed, 0 failedstate.dbsnapshot (missinglast_read_at):no such column: last_read_at✅SessionDBopen adds the column (53 cols) ✅list_sessions_rich(limit=3)returns rows ✅