fix(update): restart hermes-serve systemd units alongside gateways (#83438) - #87859
Merged
Conversation
hermes update discovered and restarted hermes-gateway* systemd units but never looked for hermes-serve* — the Desktop app's backend — so it kept running stale pre-update code until the user restarted it by hand (#83438). Extend the systemd unit discovery/restart loop to also match hermes-serve* units. They don't wire SIGUSR1 to a graceful drain (only gateway/run.py does), so restart eligibility for the graceful path is now gated on unit name via a small, directly-tested helper; hermes-serve units fall straight to the existing blunt systemctl restart path, matching the workaround the issue already documents.
…tarts Review on #83595 flagged two service-lifecycle gaps in the hermes-serve restart support: - The unit-name gate accepted anything starting with "hermes-serve", which also matched the unrelated hermes-server.service. Require the exact base unit or the hyphenated profile family instead. - The fleet-restart loop and _finish_dashboard_update_cleanup() could both restart the same hermes-serve unit — the loop restarts it directly, then cleanup's PID scan finds the fresh process and restarts its owning unit again. Thread the fleet loop's restarted unit names through to _kill_stale_dashboard_processes() so it skips units already handled.
Mirror the strict unit-name shape from the hermes-serve gate (review on PR #83595) on the gateway side too: the discovery gate and the SIGUSR1 eligibility helper now accept only `hermes-gateway.service` or the `hermes-gateway-<profile>` family, so a near-prefix unit like `hermes-gatewayd.service` can neither enter the restart path nor be sent a SIGUSR1 it does not handle.
Contributor
૮ >ﻌ< ა ci reviewran on 686afb4 — fix(update): tighten gateway-side unit gates to exact/hyphen
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
hermes updatenow discovers and restartshermes-serve*systemd units (the Desktop app's backend) alongsidehermes-gateway*, so the Serve backend no longer keeps running stale pre-update code until a manualsystemctl --user restart hermes-serve. Fixes #83438.Salvage of #83595 by @chelsealong — both commits cherry-picked onto current main with authorship preserved (the branch was ~1470 commits stale, CONFLICTING). Conflicts in
main.py(lazy-export refactor) andupdate_cmd.py(process-scan reload, #78574 snapshot bookkeeping) resolved in favor of current main + the PR's intent.Changes
hermes_cli/update_cmd.py: fleet-restartlist-unitsdiscovery now matcheshermes-serve*; unit-name gate accepts the exacthermes-serve.service/hermes-serve-*family; new_service_unit_supports_graceful_sigusr1_restart()routes serve units past the SIGUSR1 drain (onlygateway/run.pyinstalls that handler) straight to bluntsystemctl restart.hermes_cli/dashboard_procs.py:_kill_stale_dashboard_processes(already_restarted_units=...)skips PIDs whose owning unit the fleet loop already restarted — no double restart on Serve-only installs. Only successfully-restarted units are forwarded (restarted_servicesappends strictly after_wait_for_service_activesucceeds), so failed restarts still get the stale-kill sweep.hermes-gateway.service/hermes-gateway-*), so a near-prefix unit likehermes-gatewaydcan't enter the restart path or receive an unhandled SIGUSR1.Validation
test_update_fleet_restart_timeout.py+test_update_stale_dashboard.pyhermes_cli.main)contributors/emails/chelsealong@126.com)Infographic