# NousResearch/hermes-agent · Gateway exit code on intentional systemd stops

## Open now

- 2 issues, 4 PRs open on GitHub.
- #24344: \[Bug\]: Systemd gateway service exits with status 1 on intentional stop
- #41631: \[Bug\]: gateway exits code 1 (→ unit 'failed') on systemctl stop; planned stops should exit 0
- PR #24351: fix(gateway): make intentional systemd stops exit cleanly
- PR #41642: fix(gateway): exit 0 on systemctl stop instead of exit 1 (failed unit)
- PR #41690: fix(gateway): exit 0 when systemd sends SIGTERM via systemctl stop
- PR #42555: fix(gateway): write planned-stop marker from systemd ExecStop

Members share one theme: the gateway reportedly exits with code 1 when stopped via systemctl stop, so systemd may show the unit in a \`failed\` state. Issues and pull requests propose treating such stops as planned, using approaches such as exit 0 on SIGTERM or an ExecStop-written planned-stop marker.

## TL;DR

- 9 member(s): 2 open issue(s), 1 closed issue(s), 4 open PR(s), 0 merged PR(s), 2 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.19`: 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

- #24344: \[Bug\]: Systemd gateway service exits with status 1 on intentional stop
- #41631: \[Bug\]: gateway exits code 1 (→ unit 'failed') on systemctl stop; planned stops should exit 0

## Closed / duplicate issues

- #42517: fix(gateway): ExecStop should write planned-stop marker instead of inferring signal source

## Prior & competing PRs

- **#24351: fix(gateway): make intentional systemd stops exit cleanly**. open
  - maintainer direction: category `uncategorized`; implication `needs_llm`; refs `002c45998`
  - files: `hermes_cli/gateway.py`, `hermes_cli/main.py`, `tests/hermes_cli/test_gateway.py`, `tests/hermes_cli/test_gateway_service.py`
- **#41639: fix(gateway): treat SIGTERM under systemd as planned stop (exit 0)**. closed without merge
  - maintainer direction: category `superseded_by_pr`; implication `superseded`; refs `#41642`, `#41631`
- **#41642: fix(gateway): exit 0 on systemctl stop instead of exit 1 (failed unit)**. open
  - maintainer direction: category `duplicate_of`; implication `duplicate`; refs `#41639`, `#41631`
  - files: `gateway/run.py`, `tests/gateway/test_systemd_stop_exit_code.py`
- **#41690: fix(gateway): exit 0 when systemd sends SIGTERM via systemctl stop**. open
  - maintainer direction: category `duplicate_of`; implication `duplicate`; refs `#41642`, `#41639`, `#41631`
  - files: `gateway/run.py`, `tests/test_issue_41631_fix.py`
- **#42555: fix(gateway): write planned-stop marker from systemd ExecStop**. open
  - maintainer direction: category `superseded_by_pr`; implication `superseded`; refs `#43236`, `#42675`, `#41631`
  - files: `hermes_cli/gateway.py`, `hermes_cli/subcommands/gateway.py`, `tests/hermes_cli/test_gateway_service.py`
- **#113358: fix(gateway): mark planned systemd stops**. closed without merge
  - maintainer direction: category `stale_abandoned`; implication `active`; refs `#24351`, `#42517`, `#42555`, `#85901`

## Fix status

- No merged fix on record.
- Subsystem: `gateway`
- Kind: `bug` (from the open issues' GitHub type labels).
