fix(cron): add standalone cron daemon mode - #43864
Conversation
|
Context for maintainers: This is a re-creation of original PR #41363 (previously #41167 after splitting the provider-config changes). That was caught in a circular close: the original was closed by the author to split into focused PRs, and the focused version was then flagged as a duplicate of the already-closed original. The fix landed in neither. The underlying issue (#41037 — cron jobs never execute when gateway isn't running) is still open. This PR has been rebased on latest main (d1383a6). |
|
👋 @NousResearch/maintainers this PR has been rebased on latest main with 100% green CI across all checks (no failures). This implements a standalone cron daemon mode so cron jobs execute without the gateway running (issue #41037). When the gateway isn't available, starts a lightweight scheduler that runs jobs independently. Could a maintainer take a look? |
|
@OutThisLife @austinpickett — this PR has been fully green and ready for review. Fixes #41037 (cron jobs don't execute without gateway). Could either of you take a look when you get a chance? |
|
Thanks for preserving the focused standalone-daemon idea. The feature is still absent on current main, but this version needs rework for the scheduler architecture that landed after its base. Problems
Suggested changes
Automated hermes-sweeper review. |
- Add hermes cron daemon subcommand for headless/standalone operation
- Add gateway lifecycle command defense (#30719) in cron_create()
- Fix null-repeat bug in cron_list (job.get('repeat') or {})
- _GATEWAY_LIFECYCLE_PATTERNS to block gateway restart/stop/kill in cron jobs
Co-authored-by: Ash <alaamohanad169-ship-it@users.noreply.github.com>
0242f02 to
303fb57
Compare
|
👋 CI passing. Ready for review/merge when convenient. Thanks! |
What does this PR do?
Adds
hermes cron daemoncommand to run the cron scheduler as a standalone process, independent of the gateway.Problem: Cron jobs don't execute on systems where the gateway isn't running (Windows without service installation, headless servers, etc.). The cron scheduler only runs inside the gateway process, so if the gateway isn't started, cron jobs never fire.
Solution: New
hermes cron daemoncommand that runs the same tick loop as the gateway's internal cron ticker, but as a standalone process.Changes Made
hermes_cli/cron.py: Addedcron_daemon()function that runs the cron tick loop with signal handlinghermes_cli/main.py: Addeddaemonsubcommand parser with--intervaloption (default 60s)How to Test
Create a cron job:
Start the cron daemon:
Verify the job executes (check
hermes cron listforlast_run_at)Stop with Ctrl+C
Related Issue
Fixes #41037 (Cron jobs never execute: last_run_at always null after manual trigger)
Type of Change
Checklist