# NousResearch/hermes-agent · state.db corruption from concurrent gateway writes

## Open now

- Nothing open on GitHub.

These items address a shared state.db corruption problem caused by multiple processes or concurrent gateway restarts writing simultaneously. Fixes involve serialization, opt-out flags, cross-process locking, and restricting which processes are permitted to write to state.db.

## TL;DR

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

- #102120: hosted_room_worker corrupts shared state.db on simultaneous multi-profile gateway restart (e.g. via \`hermes update\`)

## Prior & competing PRs

- **#108076: state.db no longer gets a second writer from profile gateways, the dashboard, the lifecycle guard or doctor --fix (#102120 #107688 #102589 #107440; salvage #103489 #102682 #108012 #105428)**. merged to main · fix tier `verified`
  - maintainer direction: category `merged`; implication `superseded`
  - files: `contributors/emails/[redacted:email]`, `cron/lifecycle_guard.py`, `gateway/hosted_room_policy_checkpoint.py`, `gateway/hosted_rooms.py`, `hermes_cli/doctor_state.py`, `hermes_cli/web_server_lifecycle.py`, `hermes_state_holders.py`, `tests/cron/test_lifecycle_guard_live_db.py`, `tests/gateway/test_hosted_rooms.py`, `tests/hermes_cli/test_doctor_wal_holder_guard.py`, `tests/hermes_cli/test_web_server.py`, `tests/state/test_fts_holder_instance_scope.py`, `tests/tui_gateway/test_groups_methods.py`, `tests/tui_gateway/test_hosted_room_service.py`, `tui_gateway/hosted_room_service.py`
- **#102153: fix(gateway): serialize hosted-rooms first-open of shared state.db**. closed without merge
  - maintainer direction: category `uncategorized`; implication `needs_llm`; refs `#102120`, `#102120`
- **#102176: hosted_rooms: add cross-process lock to prevent state.db corruption on concurrent gateway startup**. closed without merge
  - maintainer direction: category `uncategorized`; implication `needs_llm`
- **#102237: fix(gateway): opt-out flag for hosted rooms worker to prevent concurrent-restart corruption (#102120)**. closed without merge
  - maintainer direction: category `superseded_by_pr`; implication `superseded`; refs `902eccae3f`, `#108076`

## Fix status

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