# NousResearch/hermes-agent · Test session leaking into production state.db fix

## Open now

- Nothing open on GitHub.

These items all address the same bug: DEFAULT_DB_PATH is evaluated at import time as a module-level constant, causing pytest test sessions to write to the production state.db instead of an isolated test database. Fixes involve lazy evaluation and hermetic test fixtures.

## 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 #74517. Verify it addresses your case.
- **Recommended:** read PR #74517 (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: `unresolved`. 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

- #50681: Bug: pytest 测试会话泄漏到生产 state.db（DEFAULT_DB_PATH 模块级常量在 import 时冻结）

## Prior & competing PRs

- **#74517: test: land the test-stability backlog — 12 PRs salvaged, Windows hermeticity, fail-closed guards, event-based waits**. merged to main · fix tier `verified`
  - maintainer direction: category `merged`
  - files: `.github/workflows/tests.yml`, `contributors/emails/[redacted:email]`, `contributors/emails/[redacted:email]`, `contributors/emails/[redacted:email]`, `contributors/emails/[redacted:email]`, `gateway/restart.py`, `gateway/slash_commands.py`, `hermes_cli/web_server.py`, `hermes_state.py`, `plugins/memory/honcho/session.py`, `scripts/run_tests.sh`, `tests/agent/test_anthropic_keychain.py`, `tests/agent/test_copilot_acp_client.py`, `tests/agent/test_vision_routing_31179.py`, `tests/conftest.py`, `tests/cron/test_sessiondb_init_hang.py`, `tests/gateway/test_approve_deny_commands.py`, `tests/gateway/test_complete_path_at_filter.py`, `tests/gateway/test_restart_drain.py`, `tests/gateway/test_restart_service_detection.py` (+13 more)
- **#50695: fix(state): use lazy evaluation for default DB path to prevent test-to-production DB leakage**. closed without merge
  - maintainer direction: category `duplicate_of`; implication `duplicate`
- **#50699: fix(tests): pin DEFAULT_DB_PATH in hermetic fixture to prevent production state.db leak (#50681)**. closed without merge
  - maintainer direction: category `implemented_elsewhere`; implication `superseded`; refs `#74517`, `#11875`, `#50681`

## Fix status

- Merged to main in PR #74517 (cited above). No release data is tracked. Verify downstream.
- Fix last verified (merged) `2026-07-30`.
- Subsystem: `agent`
