Skip to content

fix(cli): launchd KeepAlive unconditional restart (#37388) - #39000

Merged
teknium1 merged 2 commits into
mainfrom
hermes/hermes-58191b06
Jun 4, 2026
Merged

fix(cli): launchd KeepAlive unconditional restart (#37388)#39000
teknium1 merged 2 commits into
mainfrom
hermes/hermes-58191b06

Conversation

@teknium1

@teknium1 teknium1 commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Summary

The macOS launchd gateway now restarts after a clean (exit-0) gateway run --replace handoff, instead of staying down until manually restarted.

Root cause: the plist shipped KeepAlive.SuccessfulExit=false, so launchd only respawned on a non-zero exit. A --replace restart exits cleanly (code 0), which launchd treats as success and does not relaunch — Telegram/crons silently die.

Changes

  • hermes_cli/gateway.py: generate_launchd_plist() now emits scalar <key>KeepAlive</key><true/> (restart regardless of exit code); updated the _graceful_restart_via_sigusr1 and launchd_stop doc comments to match.
  • tests/hermes_cli/test_gateway_service.py: new test_launchd_plist_keepalive_unconditional asserts the scalar form is present and the old SuccessfulExit dict is gone.
  • scripts/release.py: AUTHOR_MAP entry for the contributor's commit email.

Validation

Before After
launchd restart on clean --replace exit no — gateway stays down yes
tests/hermes_cli/test_gateway_service.py -k launchd 15 passed

Salvage of #38796 (@ashishpatel26) onto current main; commit authorship preserved via cherry-pick. Closes #37388.

Duplicate PRs for the same issue — #37411 (@Tranquil-Flow, first submitted) and #37534 (@kyssta-exe) — credited and closed.

Infographic

launchd-keepalive-fix

ashishpatel26 and others added 2 commits June 4, 2026 05:25
Replace KeepAlive.SuccessfulExit=false dict with <key>KeepAlive</key><true/>
so launchd restarts hermes-gateway on any exit, matching the documented
drain-then-exit restart protocol used by --graceful-restart.
@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

🔎 Lint report: hermes/hermes-58191b06 vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 9792 on HEAD, 9792 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 5085 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@teknium1
teknium1 merged commit c14e6b4 into main Jun 4, 2026
23 checks passed
@teknium1
teknium1 deleted the hermes/hermes-58191b06 branch June 4, 2026 12:38
@alt-glitch alt-glitch added type/bug Something isn't working comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists labels Jun 4, 2026
@abhishekkumar62000

Copy link
Copy Markdown

Ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard 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.

[Bug]: gateway launchd KeepAlive (SuccessfulExit:false) doesn't restart after a clean --replace exit on macOS

4 participants