Skip to content

fix(gateway): wait for systemd restart to become active#8674

Closed
sgaofen wants to merge 1 commit into
NousResearch:mainfrom
sgaofen:codex/systemd-restart-waits-active
Closed

fix(gateway): wait for systemd restart to become active#8674
sgaofen wants to merge 1 commit into
NousResearch:mainfrom
sgaofen:codex/systemd-restart-waits-active

Conversation

@sgaofen

@sgaofen sgaofen commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • keep systemd_restart() from returning immediately after a graceful self-restart request by waiting for the old gateway process to exit
  • poll systemctl is-active until the unit transitions away from the old active state and comes back active again, then report a completed restart instead of a fire-and-forget request
  • cover both the success and timeout paths in test_gateway_service.py without falling back to reload-or-restart

Fixes #8260.

Testing

  • python3 -m py_compile /Users/stephenyu/Documents/hermes-agent-wt-8260/hermes_cli/gateway.py /Users/stephenyu/Documents/hermes-agent-wt-8260/tests/hermes_cli/test_gateway_service.py
  • uv run --directory /Users/stephenyu/Documents/hermes-agent-wt-8260 --extra dev pytest -o addopts='' /Users/stephenyu/Documents/hermes-agent-wt-8260/tests/hermes_cli/test_gateway_service.py -q

Platform Tested

  • macOS 15.x (Apple Silicon)

Contribution Guide Notes

  • Reviewed CONTRIBUTING.md and checked for existing open PRs before submitting this scoped bug fix.
  • Ran the targeted verification commands listed above for this PR. I have not claimed a full repo-wide pytest tests/ -q pass unless explicitly noted.

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for this contribution @sgaofen! This fix was superseded before it could be merged.

A maintainer landed an equivalent fix to main one day after this PR was opened:

The approach in this PR and the approach on main are functionally identical; main's version goes a bit further by extracting the wait logic into a reusable helper and using _read_systemd_unit_properties() for richer state introspection. No further action needed here.

This is an automated hermes-sweeper review.

@teknium1 teknium1 closed this Apr 28, 2026
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery labels Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

hermes gateway restart returns before restart completes

3 participants