# NousResearch/hermes-agent · Gateway --replace flag deadlocks and race conditions

## Open now

- 0 issues, 2 PRs open on GitHub.
- PR #119488: fix(gateway): stop cross-profile replace restart loops
- PR #119492: fix(gateway): --replace degrades to START beside another profile's standalone owner

Multiple fixes and a bug report targeting the gateway's --replace mechanism, addressing deadlocks, race conditions, restart loops, and stale systemd drop-ins related to cross-profile ownership and lock handling.

## TL;DR

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

- #119467: \[Bug\] A Hermes-written systemd --replace drop-in becomes a permanent gateway deadlock after update (Refusing --replace: PID n cannot be proven to belong to this profile's gateway)

## Prior & competing PRs

- **#120122: fix(gateway): --replace no longer starts a second gateway on a lost lock race, respawn-storms beside a standalone owner, or deadlocks on the stale systemd drop-in (#119837, #119807, #119467)**. merged to main · fix tier `verified`
  - maintainer direction: category `merged`
  - files: `gateway/host_attach.py`, `gateway/run.py`, `hermes_cli/gateway_service_unit.py`, `tests/gateway/test_host_attach_lifecycle.py`, `tests/gateway/test_host_gateway_lock_refusal.py`, `tests/hermes_cli/test_systemd_replace_dropin.py`, `website/docs/user-guide/multi-profile-gateways.md`
- **#119488: fix(gateway): stop cross-profile replace restart loops**. open
  - maintainer direction: category `superseded_by_pr`; implication `superseded`; refs `#120122`, `#119808`, `#119838`, `#119517`
  - files: `gateway/host_attach.py`, `gateway/run.py`, `tests/gateway/test_host_attach_lifecycle.py`
- **#119492: fix(gateway): --replace degrades to START beside another profile's standalone owner**. open
  - maintainer direction: category `superseded_by_pr`; implication `superseded`; refs `#120122`, `#119808`, `#119838`, `#119517`
  - files: `gateway/host_attach.py`, `gateway/run.py`, `tests/gateway/test_host_attach_lifecycle.py`
- **#119517: fix(gateway): retire the Hermes systemd --replace drop-in on unit refresh**. closed without merge
  - maintainer direction: category `merged_via`; implication `superseded`; refs `1a4da74add`, `#120122`
- **#123164: fix(gateway): surface fatal --replace aborts on stderr so the supervisor sees them**. closed without merge
  - maintainer direction: category `uncategorized`; implication `needs_llm`

## Fix status

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