Skip to content

fix(update): restart systemd-supervised remote backends after killing stale processes - #69029

Closed
webtecnica wants to merge 2 commits into
NousResearch:mainfrom
webtecnica:fix/68934-remote-update
Closed

fix(update): restart systemd-supervised remote backends after killing stale processes#69029
webtecnica wants to merge 2 commits into
NousResearch:mainfrom
webtecnica:fix/68934-remote-update

Conversation

@webtecnica

Copy link
Copy Markdown
Contributor

Summary

When hermes update runs on a remote backend, it kills hermes serve / hermes dashboard processes with SIGTERM. Systemd treats that as a clean stop and Restart=on-failure does not restart the service — so the Desktop never reconnects.

Changes

hermes_cli/main.py — Added four helper functions and modified _kill_stale_dashboard_processes to restart systemd-supervised processes after killing them:

  1. _get_systemd_service_for_pid(pid) — reads /proc/<pid>/cgroup and extracts the systemd service unit name
  2. _get_pid_cgroup_path(pid) — returns the raw cgroup path string
  3. _extract_scope_from_cgroup(path) — determines user vs system scope from the cgroup path
  4. _try_restart_systemd_service(name, cgroup_path) — runs systemctl restart (or systemctl --user restart)
  5. _kill_stale_dashboard_processes — snapshots cgroup info before killing each PID (cgroup metadata vanishes with the process), then restarts any systemd service units whose PIDs were killed

Closes #68934

Testing

  • Syntax verified
  • No existing unit tests for _kill_stale_dashboard_processes — integration-level function

webtecnica and others added 2 commits July 21, 2026 01:39
Previously _count_skills() only counted SKILL.md files inside the
profile's own skills/ directory, making the WebUI profile card show
a misleading low count (e.g. 0 for 'default', 30 for 'webtecnica')
even though the profile loaded 150+ skills from global + external
dirs.

Now it scans three sources:
1. Profile-specific skills/ dir (as before)
2. Global ~/.hermes/skills/ dir (via get_default_hermes_root)
3. External dirs from skills.external_dirs config

Deduplication by skill name (from YAML frontmatter) prevents double-
counting when the same skill exists in both global and profile dirs,
matching how scan_skill_commands() loads skills at runtime.

The cache is updated to key on all scanned directories and track
their combined mtime signatures.
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard area/install-update Installer, updater, packaging, wheels, doctor sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades needs-decision Awaiting maintainer decision before any implementation labels Jul 22, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Related: #39166 and #68934 cover the same update/systemd-stop family. This patch restarts the killed PID's detected service after termination, while #39166 restarts a known dashboard unit before raw termination; a maintainer should choose the intended lifecycle scope and mechanism.

@teknium1

Copy link
Copy Markdown
Contributor

Merged via PR #72192 — your commit was cherry-picked onto current main with your authorship preserved in git history (d1f3760). The unrelated profiles.py skill-count hunk was dropped as out of scope for this fix; feel free to resubmit it as its own PR. Thanks for the cgroup-snapshot approach — it's exactly what shipped.

@teknium1 teknium1 closed this Jul 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/install-update Installer, updater, packaging, wheels, doctor comp/cli CLI entry point, hermes_cli/, setup wizard needs-decision Awaiting maintainer decision before any implementation P2 Medium — degraded but workaround exists sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remote backend update can stop hermes serve without restarting it

3 participants