# NousResearch/hermes-agent · SQLite connection close-then-untrack ordering fixes

## Open now

- Nothing open on GitHub.

Multiple fixes addressing a race/ordering bug where SQLite connections were untracked before close succeeded, leaving guards in an incorrect state. Changes enforce that untracking only happens after a successful close.

## TL;DR

- 4 member(s): 0 open issue(s), 1 closed issue(s), 0 open PR(s), 1 merged PR(s), 2 PR(s) closed without merging.
- A fix was merged to main in PR #75883. Verify it addresses your case.
- **Recommended:** read PR #75883 (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-75883`. 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

- #75629: \[Bug\]: sqlite_safe_read untracks a connection before closing it, so a failed close leaves the byte-probe guard believing nothing is live

## Prior & competing PRs

- **#75883: fix(state): four session-state fixes — safe close tracking, flush-cursor class fix, row-retry, usage-PK healer**. merged to main · fix tier `verified`
  - maintainer direction: category `merged`
  - files: `agent/context_compressor.py`, `agent/turn_finalizer.py`, `contributors/emails/[redacted:email]`, `contributors/emails/[redacted:email]`, `hermes_cli/sqlite_safe_read.py`, `hermes_state.py`, `hermes_state_schema.py`, `tests/agent/test_micro_compaction.py`, `tests/agent/test_turn_finalizer_final_response_persistence.py`, `tests/run_agent/test_identity_flush.py`, `tests/state/test_no_more_rows_retry.py`, `tests/state/test_session_model_usage_pk_heal.py`, `tests/test_sqlite_lock_safe_inspection.py`
- **#75699: fix(cli): untrack sqlite connections only after close succeeds**. closed without merge
  - maintainer direction: category `merged_via`; implication `superseded`; refs `#75883`, `#75629`
- **#75709: fix(sqlite): close connection before untracking on failure (#75629)**. closed without merge
  - maintainer direction: category `duplicate_of`; implication `duplicate`; refs `#75699`

## Fix status

- Merged to main in PR #75883 (cited above). No release data is tracked. Verify downstream.
- Fix last verified (merged) `2026-08-01`.
