hermes - ✅(Solved) Fix gateway.py: add WSL/older systemd fallback for gateway user service hardening [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#28880Fetched 2026-05-20 04:01:22
View on GitHub
Comments
0
Participants
1
Timeline
5
Reactions
0
Participants
Timeline (top)
labeled ×4cross-referenced ×1

Error Message

The generated systemd unit can include directives that are not accepted or not suitable in this WSL/systemd environment, requiring a local source patch to keep the gateway service stable.

Root Cause

On WSL with older systemd, the generated Hermes gateway user service can fail or report outdated/unsupported unit settings because the unit content is not conditional on the local systemd version/capabilities.

Fix Action

Fix / Workaround

In the local WSL deployment, the durable workaround is a local hermes_cli/gateway.py patch that removes or avoids unsupported hardening directives for this environment. This is now tracked locally as a source-patch governance record:

  • created/systems/hermes/local-patches/2026-05-19-gateway-py-wsl-systemd.md

The generated systemd unit can include directives that are not accepted or not suitable in this WSL/systemd environment, requiring a local source patch to keep the gateway service stable.

PR fix notes

PR #28895: fix(gateway): omit systemd 254+ Restart keys on older systemd

Description (problem / solution / changelog)

Summary

generate_systemd_unit() in hermes_cli/gateway.py hardcodes RestartMaxDelaySec=300 and RestartSteps=5. These keys were added in systemd 254. On systemd 252 (the version shipped with Debian 12 — the recommended host for hermes-gateway on production homelabs) systemd logs both as unknown and ignores them, polluting the journal with two Unknown key WARNINGs on every service start.

This PR detects the systemd version at unit-generation time via systemctl --version and emits the two keys only when running on systemd 254+. On older systemd the unit falls back to the existing Restart=always + RestartSec=5 behavior, which is equivalent for the common case where restarts succeed within the first attempt.

Why this matters

  • Debian 12 is the recommended host distro for self-hosted hermes-gateway (used by NousResearch's own homelab guides + the existing Ansible playbooks).
  • Two WARNINGs per service start mean every gateway restart pings whatever syslog/journalctl monitoring users have configured.
  • Users on older distros currently have to maintain a local patch to silence these warnings (I've been carrying one for ~2 weeks on my homelab).

Test plan

  • Generate unit on Debian 12 host (systemd 252): output contains Restart=always + RestartSec=5 only, no RestartMaxDelaySec / RestartSteps. No Unknown key warnings in journalctl -u hermes-gateway.
  • Generate unit on Ubuntu 24.04 host (systemd 255): output identical to current behavior; both keys present.
  • Service restarts cleanly on failure in both cases.
  • No regression on macOS / non-systemd hosts (the helper falls through to return False on systemctl --version failure).

Backwards compatibility

The fallback path on systemd <254 is Restart=always + RestartSec=5 — same as systemd 254+ for any restart that succeeds on the first attempt. The only behavioral difference is exponential backoff between repeated failures, which only kicks in if the service is in a crash loop. For users in a crash loop, the journal warnings were never the priority issue anyway.

Closes #28880.

Changed files

  • hermes_cli/gateway.py (modified, +33/-6)
RAW_BUFFERClick to expand / collapse

Bug description

On WSL with older systemd, the generated Hermes gateway user service can fail or report outdated/unsupported unit settings because the unit content is not conditional on the local systemd version/capabilities.

In the local WSL deployment, the durable workaround is a local hermes_cli/gateway.py patch that removes or avoids unsupported hardening directives for this environment. This is now tracked locally as a source-patch governance record:

  • created/systems/hermes/local-patches/2026-05-19-gateway-py-wsl-systemd.md

Environment

  • Platform: WSL / Ubuntu user systemd service
  • Service: hermes-gateway user service
  • Hermes install: git checkout under ~/.hermes/hermes-agent

Observed behavior

The generated systemd unit can include directives that are not accepted or not suitable in this WSL/systemd environment, requiring a local source patch to keep the gateway service stable.

Examples from the local patch/governance note include WSL-specific handling around hardening directives such as ProtectHome and ProtectKernelTunables.

Expected behavior

hermes_cli/gateway.py should generate a gateway systemd unit that gracefully adapts to the target systemd environment, or otherwise falls back with clear guidance, so WSL users do not need to maintain a local source patch.

Proposed fix shape

One of:

  1. Detect systemd version/capabilities before generating the unit and conditionally omit unsupported/incompatible directives.
  2. Generate a conservative WSL-safe unit when running under WSL.
  3. Keep the default hardened unit for modern Linux systemd, but add a graceful fallback path for older/WSL systemd environments.

Why this issue exists

This is filed as part of local source-patch governance cleanup. The local runtime currently carries one active gateway.py patch after an upstream kanban-db patch was superseded by upstream PR #28781. This issue gives the remaining gateway patch an upstream tracking handle instead of leaving it as an ambiguous local-only modification.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

hermes_cli/gateway.py should generate a gateway systemd unit that gracefully adapts to the target systemd environment, or otherwise falls back with clear guidance, so WSL users do not need to maintain a local source patch.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING