# NousResearch/hermes-agent · Cron timeout and SessionDB close ordering around agent worker teardown

## Open now

- 2 issues, 1 PR open on GitHub.
- #18004: Cron inactivity timeout can mark a job failed while the agent thread keeps running
- #54755: cron run_job closes session DB before agent.close(), causing "Session DB append_message failed: 'NoneType' object has no attribute 'execute'"
- PR #54788: fix(cron): keep SessionDB open until agent teardown completes

Most members concern cron jobs where an inactivity timeout or interrupt, or a run_job cleanup step, may close SessionDB while the agent worker thread is still running. The reported symptoms include lost session writes and append_message errors, and the PR titles propose waiting for agent teardown or bounding the worker wait before closing.

## TL;DR

- 8 member(s): 2 open issue(s), 1 closed issue(s), 1 open PR(s), 1 merged PR(s), 3 PR(s) closed without merging.
- A fix was merged to main in PR #104456. Verify it addresses your case.
- **Recommended:** read PR #104456 (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: `partially_resolved` · deciding PR(s): `pr-104456`. 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.20`: 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

- #18004: Cron inactivity timeout can mark a job failed while the agent thread keeps running
- #54755: cron run_job closes session DB before agent.close(), causing "Session DB append_message failed: 'NoneType' object has no attribute 'execute'"

## Closed / duplicate issues

- #65208: Cron inactivity timeout closes SessionDB while the agent worker thread is still running → intermittent silent session-write loss

## Prior & competing PRs

- **#104456: SessionDB teardown no longer overlaps a live handle for the same state.db: counted per-path barrier + cron workers own their teardown (#102827, salvage of #103118 by @JoaoMarcos44)**. merged to main · fix tier `verified`
  - maintainer direction: category `merged`
  - files: `agent/trace_upload.py`, `cron/scheduler.py`, `cron/scheduler_detached_worker.py`, `gateway/platforms/api_server.py`, `gateway/run.py`, `hermes_cli/web_server_lifecycle.py`, `hermes_cli/web_server_sessions.py`, `hermes_state_registry.py`, `tests/cron/test_cleanup_timeout.py`, `tests/cron/test_scheduler.py`, `tests/hermes_state/test_shared_session_db_registry.py`
- **#39782: fix(cron): contain timed-out cron workers (#18004)**. closed without merge
  - maintainer direction: category `uncategorized`; implication `needs_llm`
- **#54788: fix(cron): keep SessionDB open until agent teardown completes**. open
  - maintainer direction: category `implemented_elsewhere`; implication `superseded`; refs `ece36e1e57408524ce0c307480af932998dc7138`
  - files: `cron/scheduler.py`, `tests/cron/test_run_one_job.py`, `tests/cron/test_scheduler.py`
- **#65227: fix(cron): wait for agent cleanup after interrupt before closing SessionDB (#65208)**. closed without merge
  - maintainer direction: category `superseded_by_pr`; implication `superseded`; refs `#104456`, `#103118`
- **#65285: fix(cron): bound worker wait before SessionDB close (#65208)**. closed without merge
  - maintainer direction: category `implemented_elsewhere`; implication `superseded`

## Fix status

- Merged to main in PR #104456 (cited above). No release data is tracked. Verify downstream.
- Fix last verified (merged) `2026-09-06`.
- Subsystem: `cron`
- Kind: `bug` (from the open issues' GitHub type labels).
