# NousResearch/hermes-agent · Hermetic systemd tests for non-systemd environments

## Open now

- Nothing open on GitHub.

These issues and PRs address gateway service refresh tests that fail in environments without systemd (e.g., containers or root contexts). The work involves mocking or bypassing the systemd D-Bus preflight check to make the tests self-contained and reliably runnable anywhere.

## TL;DR

- 6 member(s): 0 open issue(s), 2 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 #61384. Verify it addresses your case.
- **Recommended:** read PR #61384 (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-61384`. 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.29`: 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

- #15187: \[Bug\]: test_gateway_service systemd refresh tests fail in non-systemd environments after user D-Bus preflight
- #18630: Stabilize gateway service tests in container/root environments

## Prior & competing PRs

- **#15190: test(gateway): make systemd refresh tests hermetic with user D-Bus preflight**. closed without merge · fix tier `suggested`
  - maintainer direction: category `uncategorized`; implication `needs_llm`; refs `#15254`, `#15243`, `#15244`
  - _suggested-tier fix detail withheld; re-request with `?tier=all` to include it._
- **#61384: test(gateway): mock systemd preflight in service-refresh tests for non-systemd hosts (salvage #15435)**. merged to main · fix tier `verified`
  - maintainer direction: category `merged`; implication `superseded`
  - files: `tests/hermes_cli/test_gateway_service.py`
  - fix hunks:
  - `tests/hermes_cli/test_gateway_service.py`

    ```diff
    @@ -68,6 +68,10 @@ def test_systemd_start_refreshes_outdated_unit(self, tmp_path, monkeypatch):
     
             monkeypatch.setattr(gateway_cli, "get_systemd_unit_path", lambda system=False: unit_path)
             monkeypatch.setattr(gateway_cli, "generate_systemd_unit", lambda system=False, run_as_user=None: "new unit\n")
    +        # Bypass systemd availability checks — this test targets unit-file
    +        # refresh logic, not D-Bus reachability (fails on macOS/WSL/Docker).
    +        monkeypatch.setattr(gateway_cli, "_preflight_user_systemd", lambda **kw: None)
    +        monkeypatch.setattr(gateway_cli, "_select_systemd_scope", lambda system=False: False)
     
             calls = []
     
    ```

    ```diff
    @@ -91,6 +95,10 @@ def test_systemd_restart_refreshes_outdated_unit(self, tmp_path, monkeypatch):
     
             monkeypatch.setattr(gateway_cli, "get_systemd_unit_path", lambda system=False: unit_path)
             monkeypatch.setattr(gateway_cli, "generate_systemd_unit", lambda system=False, run_as_user=None: "new unit\n")
    +        # Bypass systemd availability checks — this test targets unit-file
    +        # refresh logic, not D-Bus reachability (fails on macOS/WSL/Docker).
    +        monkeypatch.setattr(gateway_cli, "_preflight_user_systemd", lambda **kw: None)
    +        monkeypatch.setattr(gateway_cli, "_select_systemd_scope", lambda system=False: False)
     
             calls = []
             monkeypatch.setattr("gateway.status.get_running_pid", lambda: None)
    ```
- **#15435: fix(cli): mock systemd preflight in gateway service tests for non-systemd environments (#15187)**. closed without merge
  - maintainer direction: category `merged_via`; implication `superseded`; refs `#61384`, `#61384`, `#61384`
- **#23787: test(cli): keep systemd refresh unit tests hermetic after preflight (#15187)**. closed without merge
  - maintainer direction: category `duplicate_of`; implication `duplicate`; refs `#15435`, `#15187`

## Fix status

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