fix(update): preserve non-prefixed systemd gateway process - #80135
Open
pankajarm wants to merge 1 commit into
Open
fix(update): preserve non-prefixed systemd gateway process#80135pankajarm wants to merge 1 commit into
pankajarm wants to merge 1 commit into
Conversation
pankajarm
marked this pull request as ready for review
August 6, 2026 08:49
monerostar
reviewed
Aug 13, 2026
monerostar
left a comment
Contributor
There was a problem hiding this comment.
Ubuntu 26.04 LTS / kernel 7.0.0-28-generic on a local 5800X box. Read-only /proc check, no hermes update run.
origin/main 4a6d3640b has neither _systemd_service_membership_for_pid nor _select_update_manual_gateway_pids.
PR tip 2ece25503 against live PIDs:
- gateway MainPID 1965554 cgroup
.../app.slice/hermes-gateway-main.service-> True - session-scope pid 6521
.../session-5.scope-> False - init.scope pid 1 -> False
- select([gateway, session], known_service_pids=empty, systemd_supported=True) -> [6521] only
So a prefixed unit is already safe, and a custom-named .service cgroup would also stay out of the raw SIGTERM sweep.
PYTHONPATH=$WT pytest tests/hermes_cli/test_update_gateway_pid_classification.py -o addopts=: 8 passed.
Looks good from Linux.
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
Fixes an updater safety gap for non-prefixed systemd-managed Hermes gateways.
hermes updatealready excludes activehermes-gateway*service PIDs from its manual-process sweep. A valid gateway run owned by a custom system unit (for examplegaiasignal-agent-hermes.service) was not in that set, then was rediscovered as a manual process and sentSIGTERM.This focused patch classifies only existing positive
gateway runcandidates at the update manual-sweep boundary using/proc/<pid>/cgroup:0::/...unit.serviceand v1name=systemd:/...unit.service=> managed service, never raw-SIGTERM;systemctlenumeration and no unit-name-prefix trust.Why
A real custom systemd service was interrupted by the generic updater and systemd recovered it roughly five seconds later. The update code must not treat system-manager ownership as manual merely because the unit name is outside the standard
hermes-gateway*convention.Verification
Fork branch commit
2ece25503:Reviewed/rebased validation commit
02f1a138on current upstream8f271272:The new focused coverage verifies custom v2 and legacy v1 service cgroups, normal manual session scopes, unreadable cgroups, a false capability-probe path, non-systemd manual behavior, and preservation of targeted existing service discovery. A read-only check classified the affected live service PID as managed (
True) without updating or restarting it.Scope / safety
Maintainer note
The personal fork is 534 commits behind current
mainbecause its PAT cannot push inherited workflow-file updates. GitHub compare shows this branch is ahead by one commit with exactly these two file changes. Please rebase/cherry-pick the focused patch onto currentmainbefore merging.Related context: closed unmerged #5409 added the existing standard-service exclusion; open #20488 and #16349 concern status/profile reporting rather than update-time termination; open #77854 addresses updater-owning standard gateway lifecycle and is currently dirty. No exact duplicate was found.