Conversation
Contributor
Author
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.
What does this PR do?
Opens the remaining observational CLI session stores read-only, so nested inspection commands never mint a second writable WAL handle while a gateway owns the store.
Complements the read-only conversion family — #109725 (sessions), #110026 (insights, salvage of #109737), #110186 (status/doctor/sessions/insights) — covering only the openers outside all three diffs:
main._session_db()(MRU search, title/ID resolve, cwd restore), terminal breadcrumb resolution, the TUI exit summary, and consolesessions list/stats/export. Console mutating paths (rename,optimize,repair) stay writable via a split helper.Draft status: opened as a draft while the sibling family (#109725 / #110026 / #110186) resolves landing order. No review requested yet; CI on this fork head reports
no checksuntil a maintainer approves the run.Symptom
Running
hermes -c <name>, resolving a bare-cbreadcrumb, exiting the TUI, or running consolesessions listduring a live gateway turn opened another writable handle. Close-time WAL lifecycle work on that handle could retire the live writer's generation and halt the turn.Bug Cause
Trigger: these helpers constructed
SessionDB()with its writable default.Causal chain:
state.dbWAL generation.-cresolve, breadcrumb, TUI epilogue, console list) opens a second writable handle.Why it is wrong: these paths only query state and must not hold writer privileges.
Ruled out: no schema, migration, checkpoint, or recovery-transaction changes; intentional writers (
--create-if-missing, oneshot turns, foreign import, kanban retag) keep writable access.Sibling audit (same shape, every path):
main.py:1341(titled-session create),oneshot.py:274(live turn persistence),foreign_sessions.py:246(import writes),kanban_db_dispatch.py:2085(one-shot retag write) are writers by contract and stay writable. Consolerename/optimize/repairkeep the writable helper.Related Issue
Related to #110173 (observational-opener class). Complements #109725 / #110026 / #110186 — disjoint file set, no overlap. No
Fixesclaimed; a maintainer can link as preferred.Type of Change
Changes Made
hermes_cli/main.py—_session_db()yieldsSessionDB(read_only=True)(MRU search, title/ID resolve, cwd restore are all reads).hermes_cli/terminal_breadcrumbs.py—resolve_breadcrumb_session()opens read-only (get_session+get_compression_tiponly).hermes_cli/main_tui_launch.py—_print_tui_exit_summary()opens read-only (get_session+get_session_titleonly).hermes_cli/console_engine.py— new_session_db_readonly()forsessions list,sessions stats,sessions export(export guard is assert-only); fails closed with "No session database yet" instead of minting a store when none exists.rename,optimize,repairkeep the writable helper.tests/hermes_cli/test_observational_readonly_remaining.py— 9 tests: mode assertions per entrypoint, missing-db fail-closed without minting, live-writer WAL preservation. Sabotage (fix reverted to base): 7 fail / 2 pass; restored: 9 pass.tests/hermes_cli/test_resolve_last_session.py— forwards kwargs in the SessionDB fake (lambda *a, **k) so the read-only kwarg reaches the real constructor.How to Test
state.db, run-cresolve, breadcrumb resolve, consolesessions list, and the TUI summary path — the live writer creates and reads a session afterwards with its generation intact.Checklist
Code
hermes insightsopens state.db read-only (salvage #109737) #110026, fix(cli): open observational session stores read-only #110186 cover disjoint file sets; no competitor on these sites)🛠️ Dev: Halldrix
🤖 Sidekick: Hermes Agent v0.21.2
🐞 Reproduction: ✅ Confirmed (nested observational openers mint writable handles; #110173 class)