# NousResearch/hermes-agent · Session ended_at not set on exit or interruption

## Open now

- 1 issue, 1 PR open on GitHub.
- #22071: Session liveness: 29% of sessions leak with ended_at=NULL on hard exits
- PR #47292: fix(cli): end session in state.db on atexit cleanup

Multiple issues and fixes address sessions failing to record ended_at in state.db when processes exit unexpectedly, are force-quit, or disconnect, causing sessions to accumulate as open/zombie records. Fixes involve atexit handlers and transcript persistence across CLI and TUI.

## TL;DR

- 4 member(s): 1 open issue(s), 1 closed issue(s), 1 open PR(s), 0 merged PR(s), 1 PR(s) closed without merging.
- No fix has been merged to main; one or more PRs were attempted (see below).
- **Recommended:** review the prior/competing PR(s) below. A fix was attempted but not merged; your case may extend or revive that work.

## Maintainer resolution verdict

- Internal-tracker verdict over this cluster's issue members: `unresolved`. This is distinct from the fix status above. Weigh it yourself.

## How this cluster was grouped

- Link evidence (`STRUCTURAL_PARTIAL`): some members are connected by structural evidence (shared changed files, or a closing/superseded reference); the rest are joined by an automated relevance judgement over their text.
- Members outside that structural core may belong to a different underlying problem.
- Pairwise link density `0.39`: 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.

## Open related issues

- #22071: Session liveness: 29% of sessions leak with ended_at=NULL on hard exits

## Closed / duplicate issues

- #47277: WebUI/Desktop/TUI sessions never set ended_at — accumulate as zombies in state.db

## Prior & competing PRs

- **#47292: fix(cli): end session in state.db on atexit cleanup**. open
  - maintainer direction: category `uncategorized`; implication `needs_llm`
  - files: `cli.py`, `tests/cli/test_single_query_session_finalize.py`
- **#47401: fix(cli): add atexit handler to end session on unexpected exit (#47277)**. closed without merge
  - maintainer direction: category `duplicate_of`; implication `duplicate`; refs `#47292`, `#47277`

## Fix status

- No merged fix on record.
- Subsystem: `agent`
