Conversation
heathley
force-pushed
the
fix/systemd-gateway-stop-exit-status-24344
branch
from
May 12, 2026 12:32
7a6f82c to
a0b94c7
Compare
Collaborator
|
Thanks for tracing both the root-owned marker path and direct Problems
Suggested changes
Automated hermes-sweeper review. |
1 task
12 of 18 tasks
This was referenced Sep 10, 2026
This branch has not been deployed
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
Fix intentional systemd gateway stops being recorded as failures.
Today there are two separate failure paths behind this:
hermes gateway stop --systemwrites the planned-stop marker from a sudo/root context, so the marker can end up unreadable to the actual gateway service user.systemctl stopnever writes a planned-stop marker at all, so the gateway cannot distinguish an intentional stop from an unexpected SIGTERM and exits with status 1 by design.This change moves the correctness path into the systemd unit itself by adding a non-recursive
ExecStophelper that writes the planned-stop marker as the service user before systemd delivers SIGTERM.Closes #24344.
What changed
hermes gateway _write-planned-stop --pid <pid>helperExecStop=... gateway _write-planned-stop --pid $MAINPIDto generated systemd unitsExecStophelpersystemd_stop()marks the stop as planned before stoppingWhy this approach
This preserves Hermes' existing non-zero exit behavior for genuinely unexpected SIGTERM, which is still needed for
Restart=on-failurerecovery.It intentionally does not use
SuccessExitStatus=1, since that would mask real unexpected shutdown failures.Verification
Tested with targeted regression coverage:
tests/hermes_cli/test_gateway_service.py -k "execstop_helper or planned_stop_only or systemd_stop"tests/hermes_cli/test_gateway.py -k "write_planned_stop_internal_command"