fix(update): restart supervised and manually-started backends after update - #72192
Merged
Conversation
…update Capture each manually-started dashboard/serve process's argv before the stale-process kill (/proc/<pid>/cmdline on Linux, ps -o command= on macOS), then respawn it detached after the update — headless (--no-open) with output to logs/dashboard-restart.log under the active profile's HERMES_HOME. Supervised PIDs keep their systemd-unit restart; --stop stays a plain stop. Salvaged from PR #41508 with scope fixes: serve matching preserved, profile- aware log path, restart only on the update path (restart_managed=True).
Windows-footguns lint: subprocess text=True without encoding= decodes via locale.getpreferredencoding(). Match the file's house style.
teknium1
force-pushed
the
fix/update-restart-backends
branch
from
July 26, 2026 20:22
9518e8f to
7906dc4
Compare
Contributor
૮ >ﻌ< ა ci reviewran on 7906dc4 ℹ️ InfoDesktop E2E visual evidence · View test artifacts · View job1 visual diff. inline evidence upload failed. Failed to upload diff-665a0833239e-onboarding-overlay-diff.png with gh image (exit code 1): Error uploading /home/runner/work/_temp/e2e-evidence/diff-665a0833239e-onboarding-overlay-diff.png: step 0 (get upload token): uploadToken not found on repo page — do you have write access to NousResearch/hermes-agent? (or, if NousResearch enforces SAML SSO, authorize at https://github.com/orgs/NousResearch/sso) |
Collaborator
Related: #69029 and #69046 address the same update-triggered supervised-backend outage with different lifecycle mechanisms. This salvage uses post-kill cgroup/service restart and additionally covers manual process respawn; a maintainer should select the intended mechanism. |
This was referenced Jul 26, 2026
teknium1
pushed a commit
that referenced
this pull request
Jul 26, 2026
… paths - hermes dashboard --status now verifies each matched PID is alive AND bound to a listening socket before reporting it, so stale PIDs and the desktop app's IPC-only 'serve --port 0' backends no longer masquerade as running dashboards (#58578). - The git and Windows ZIP update paths share one _finish_dashboard_update_cleanup(), so the ZIP fallback gets the same stop/restart reporting. - _kill_stale_dashboard_processes returns a structured {matched, killed, failed, unrecovered} result; the explicit was-stopped notice fires only for processes that could NOT be auto-restarted, meshing with the auto-respawn from #72192.
Contributor
19 tasks
randlee
pushed a commit
to randlee/hermes-agent
that referenced
this pull request
Aug 11, 2026
… paths - hermes dashboard --status now verifies each matched PID is alive AND bound to a listening socket before reporting it, so stale PIDs and the desktop app's IPC-only 'serve --port 0' backends no longer masquerade as running dashboards (NousResearch#58578). - The git and Windows ZIP update paths share one _finish_dashboard_update_cleanup(), so the ZIP fallback gets the same stop/restart reporting. - _kill_stale_dashboard_processes returns a structured {matched, killed, failed, unrecovered} result; the explicit was-stopped notice fires only for processes that could NOT be auto-restarted, meshing with the auto-respawn from NousResearch#72192.
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
After
hermes update, killed dashboard/serve backends now come back automatically: systemd-supervised PIDs get their owning unit restarted, and manually-started processes are respawned with the argv they were launched with. Previously only the well-knownhermes-dashboard.serviceunit was restarted — a remote backend under a custom unit name, or any manually-launchedhermes serve, stayed dead until the operator SSHed in (#68934, Desktop loses connectivity after remote update).Root cause: our SIGTERM reads as a clean stop to systemd, so
Restart=on-failurenever fires; and the manual-launch path never recorded launch args, so nothing could relaunch it.Changes
hermes_cli/main.py:_get_pid_cgroup_path/_get_systemd_service_for_pid/_extract_scope_from_cgroup/_try_restart_systemd_service— snapshot each killed PID's owning systemd unit from/proc/<pid>/cgroupbefore the kill, restart it after (user/system scope aware). Salvaged from fix(update): restart systemd-supervised remote backends after killing stale processes #69029 (@webtecnica, authorship preserved; unrelatedprofiles.pyhunk dropped)._dashboard_cmdline_for_pid/_respawn_dashboard_processes— capture manually-started processes' argv (/proc/<pid>/cmdlineon Linux,ps -o command=on macOS) and respawn them detached post-update,--no-openforced, output to the active profile'slogs/dashboard-restart.log. Salvaged from fix: auto-restart dashboard after update when argv is recoverable #41508 (@Variable85, authorship preserved) with the sweeper-review fixes:servematching kept, profile-aware log path viaget_hermes_home(), capture gated to the update path.restart_managed=True(the update path);hermes dashboard --stopremains a plain stop.tests/hermes_cli/test_update_stale_dashboard.py: 11 new tests (unit restart + dedupe + failure hint, argv respawn +--no-open+ failure fallback,/proc+pscapture,--stopnever restarts). All 11 fail without the fix; the 26 pre-existing tests pass unchanged.Validation
hermes-serve.service)hermes serve/dashboardhermes dashboard --stopE2E on a live system (no mocks): real child process argv captured losslessly from
/procincluding embedded spaces; respawn ran detached with output landing inlogs/dashboard-restart.log; full kill→respawn cycle through_kill_stale_dashboard_processeskilled pid A and brought the same command back as pid B.Closes #68934. Closes #40449.
Salvages #69029 and #41508 with contributor authorship preserved.
Infographic