fix(gateway): systemd KillMode=mixed + restart drain timeout + cron stop guard (#37454 #37453 #37858) - #39577
Open
ashishpatel26 wants to merge 1 commit into
Conversation
12 tasks
teknium1
reviewed
Jul 14, 2026
teknium1
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for addressing the shutdown/restart races. The manual-restart part still applies, but the cron hunk needs rebasing onto the current scheduler architecture.
Problems
gateway/run.py:19301changes_start_cron_ticker, but current main marks that function as a deprecated compatibility shim atgateway/run.py:20324-20336. Production startscron_provider.start(...)atgateway/run.py:20836-20846;InProcessCronScheduler.start()callscron_tick()without a drain gate atcron/scheduler_provider.py:166-179. The proposedrunnerargument therefore is not on the production path.- The
KillMode=mixedchange is already on main for both generated systemd units (hermes_cli/gateway.py:2764,2798), with existing coverage intests/hermes_cli/test_gateway_service.py:426-449and537-561.
Suggested changes
- Retain and rebase the manual fallback change: main still hardcodes
timeout=10.0, force_after=5.0athermes_cli/gateway.py:7020. - Put the cron gate into the active provider startup/loop path and test that path; remove the superseded KillMode hunk.
Automated hermes-sweeper review.
| @@ -19301,10 +19301,10 @@ def _run_planned_stop_watcher( | |||
| stop_event.wait(poll_interval) | |||
Collaborator
There was a problem hiding this comment.
_start_cron_ticker is no longer the production gateway ticker on current main: it is now a deprecated shim, while start_gateway() invokes the resolved CronScheduler directly. Please move this drain gate into the active provider startup/InProcessCronScheduler.start() path; otherwise this new runner parameter is never used by the running gateway.
This was referenced Jul 28, 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
unner=None param to _start_cron_ticker(); each tick checks getattr(runner, "_draining", False) before calling cron_tick(), preventing outbound LLM calls after hermes gateway stop
Fixes #37454 #37453 #37858
🤖 Generated with Claude Code