Skip to content

fix(cron): warn user when creating cron job if gateway is not running#2793

Open
ygd58 wants to merge 4 commits into
NousResearch:mainfrom
ygd58:fix/cron-warn-gateway-not-running
Open

fix(cron): warn user when creating cron job if gateway is not running#2793
ygd58 wants to merge 4 commits into
NousResearch:mainfrom
ygd58:fix/cron-warn-gateway-not-running

Conversation

@ygd58

@ygd58 ygd58 commented Mar 24, 2026

Copy link
Copy Markdown
Contributor

Fixes #2788

Root Cause

Cron jobs only fire automatically when the gateway is running. In CLI-only mode, the cron ticker is never started, so jobs never execute. Users creating cron jobs via CLI had no indication of this.

Fix

Added _check_cron_ticker_warning() that checks if the gateway is running via get_running_pid(). When a cron job is created and the gateway is NOT running, the response includes a warning field:

⚠️ The gateway is not running — this cron job will NOT fire automatically. To enable automatic execution, run: hermes gateway run. Or manually trigger: hermes cron tick.

The LLM sees this warning and can relay it to the user.

@ygd58

ygd58 commented Mar 24, 2026

Copy link
Copy Markdown
Contributor Author

The test failure is a dependency resolution error in the CI environment (hermes-agent[all]==0.4.0 cannot be used), not caused by this PR's changes to cronjob_tools.py. This appears to be a pre-existing CI infrastructure issue.

Comment thread tools/cronjob_tools.py
"next_run_at": job["next_run_at"],
"job": _format_job(job),
"message": f"Cron job '{job['name']}' created.",
"warning": _check_cron_ticker_warning(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not able to find the function _check_cron_ticker_warning in the code base. Is this func defined?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching that! The function definition was missing from the commit. Fixed in the latest push — _check_cron_ticker_warning() is now defined at line 141 in cronjob_tools.py.

Comment thread tools/cronjob_tools.py
)
except Exception:
pass
return None

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return type is not included None
not sure if the type requirement in this repo. If it is strict, then we need to change the return type to str | None

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Fixed changed return type to Optional[str] which correctly reflects that the function can return either a warning string or None.

@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/cron Cron scheduler and job management labels May 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cron Cron scheduler and job management P3 Low — cosmetic, nice to have type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Cron jobs never run or when it failed, no useful information is recorded

3 participants