Skip to content

fix(sessions): open read-only commands without writer - #109725

Closed
Ahmett101 wants to merge 1 commit into
NousResearch:mainfrom
Ahmett101:fix/109687-sqlite-reader-wal-lock
Closed

Ahmett101 wants to merge 1 commit into
NousResearch:mainfrom
Ahmett101:fix/109687-sqlite-reader-wal-lock

Conversation

@Ahmett101

Copy link
Copy Markdown

Summary
hermes sessions stats and other display-only session subcommands opened a writable SessionDB even though they only read the store. On a live WAL database that transient writer can participate in close-time WAL cleanup and reproduce the reported deleted-sidecar generation. This change routes non-mutating session commands through SessionDB(read_only=True) while leaving mutating commands on the writable open path.

Changes
hermes_cli/sessions_cmd.py: adds a read-only handler allowlist for list, pinned, and stats, and passes read_only=True when dispatching those commands.
tests/hermes_cli/test_sessions_error_exit_codes.py: adds regression coverage that stats opens read-only and a mutating command still opens a writer.

How to Test
python -m pytest tests/hermes_cli/test_sessions_error_exit_codes.py -q

✅ 5/5 passed

ruff check hermes_cli/sessions_cmd.py tests/hermes_cli/test_sessions_error_exit_codes.py

✅ passed

python scripts/check-windows-footguns.py hermes_cli/sessions_cmd.py tests/hermes_cli/test_sessions_error_exit_codes.py

✅ passed

Notes
scripts/run_tests.sh tests/hermes_cli/test_sessions_error_exit_codes.py -q was attempted in the Termux sandbox and failed before collection with PermissionError(13, 'Permission denied'); direct pytest passed.
ruff format --check was not applied because these legacy files would be broadly reformatted unrelated to this fix.

Checklist

  • Tests pass — 5/5 targeted direct pytest
  • Follows Conventional Commits
  • Changes scoped to this fix only
  • Cross-platform impact assessed (Linux / macOS / WSL2 / Windows / Termux)
  • profile-safe paths used — no hardcoded ~/.hermes
  • .env not used for non-credential settings (behavioral settings → config.yaml)

Risk & Impact
Low. The change only selects read-only SessionDB opens for display-only session commands and keeps mutating commands writable.
Type: Bug fix
Closes: #109687

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard area/sessions Session lifecycle, resume, persistence, history sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state labels Sep 13, 2026
@kshitijk4poor

Copy link
Copy Markdown

@Ahmett101 you were first on the hermes sessions read-only half of #110173; #111627 (salvage of #110186) covers it and credits you as co-author. Closing this one in favour of #111627.

#111627 is armed to auto-merge (rebase) once its CI is green.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/sessions Session lifecycle, resume, persistence, history comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/bug Something isn't working

Projects

None yet

3 participants