# NousResearch/hermes-agent · state.db WAL lock and writer mode fixes

## Open now

- Nothing open on GitHub.

A cluster of bugs and fixes around SQLite WAL generation being orphaned or dropped when CLI commands open state.db incorrectly, plus an opt-in self-heal for lost WAL generation. All members concern state.db locking and access-mode handling.

## TL;DR

- 4 member(s): 0 open issue(s), 1 closed issue(s), 0 open PR(s), 2 merged PR(s), 1 PR(s) closed without merging.
- A fix was merged to main in PR #111627. Verify it addresses your case.
- **Recommended:** read PR #111627 (and any competing PRs below) before filing. Confirm the merged change covers your symptom.

## Maintainer resolution verdict

- Internal-tracker verdict over this cluster's issue members: `resolved` · deciding PR(s): `pr-109841`. This is distinct from the fix status above. Weigh it yourself.

## How this cluster was grouped

- Link evidence (`STRUCTURAL_SPANNING`): every member is connected by structural evidence: shared changed files, or a closing/superseded reference.
- Pairwise link density `0.50`: the share of member pairs that carry a link, counting a structural link in full and a relevance-only link at 0.36. `1.00` means every pair is linked.

## Closed / duplicate issues

- #109687: \[Bug\]: A single plain CLI invocation orphans the live gateway's \`state.db\` WAL generation on Linux (reproduces on 2026-09-12 \`main\`, after the #102589 fix) — gateway keeps serving while silently dropping session writes

## Prior & competing PRs

- **#109841: fix(state): tightening state.db modes no longer drops the holder's SQLite locks (#109786, salvage #109754)**. merged to main · fix tier `verified`
  - maintainer direction: category `merged`
  - files: `hermes_state.py`, `tests/test_hermes_state.py`
- **#111627: fix(cli): \`hermes sessions list|stats|pinned\` and a plain \`hermes doctor\` no longer open state.db as a writer (#110173, salvage #110186)**. merged to main · fix tier `verified`
  - maintainer direction: category `merged`
  - files: `hermes_cli/doctor_state.py`, `hermes_cli/sessions_cmd.py`, `hermes_state.py`, `hermes_state_dbfile.py`, `hermes_state_holders.py`, `hermes_state_repair.py`, `tests/hermes_cli/test_observational_sessiondb_modes.py`, `tests/hermes_cli/test_session_export.py`, `tests/hermes_cli/test_sessions_delete.py`, `tests/hermes_cli/test_sessions_export_md_cli.py`, `tests/hermes_cli/test_sessions_export_output_dir.py`, `tests/hermes_cli/test_sessions_pin.py`
- **#109766: hermes_state: opt-in in-place self-heal for a lost WAL generation (fixes #109687)**. closed without merge
  - maintainer direction: category `silent_close`; implication `active`

## Fix status

- Merged to main in PR #111627 (cited above). No release data is tracked. Verify downstream.
- Fix last verified (merged) `2026-09-15`.
- Subsystem: `other`
