Files
hermes-agent/cron/__init__.py
Alexander Whitestone 5890c7b406
Some checks failed
Forge CI / smoke-and-build (pull_request) Failing after 1m20s
fix(cron): SSH dispatch validation, failure detection, broken import (#350, #541)
VPS agent dispatch reported OK while remote hermes binary paths broken.
Issue was closed twice without fix merged. Verified on main: none of
these changes exist.

1. New cron/ssh_dispatch.py — validated SSH dispatch
   SSHEnvironment probes remote hermes via test -x before dispatch.
   DispatchResult returns success=False on broken paths, not silent OK.
   dispatch_to_hosts / format_dispatch_report for multi-host ops.

2. cron/scheduler.py — 7 new failure phrases in _SCRIPT_FAILURE_PHRASES
   no such file or directory, command not found, hermes binary not found,
   hermes not found, ssh: connect to host, connection timed out,
   host key verification failed.

3. cron/__init__.py — remove stale imports (#541)
   ModelContextError and CRON_MIN_CONTEXT_TOKENS dont exist in scheduler.py.
   Blocked all 'from cron import ...' statements.

Closes #350, Closes #541
2026-04-14 11:41:32 -04:00

43 lines
1.0 KiB
Python

"""
Cron job scheduling system for Hermes Agent.
This module provides scheduled task execution, allowing the agent to:
- Run automated tasks on schedules (cron expressions, intervals, one-shot)
- Self-schedule reminders and follow-up tasks
- Execute tasks in isolated sessions (no prior context)
Cron jobs are executed automatically by the gateway daemon:
hermes gateway install # Install as a user service
sudo hermes gateway install --system # Linux servers: boot-time system service
hermes gateway # Or run in foreground
The gateway ticks the scheduler every 60 seconds. A file lock prevents
duplicate execution if multiple processes overlap.
"""
from cron.jobs import (
create_job,
get_job,
list_jobs,
remove_job,
update_job,
pause_job,
resume_job,
trigger_job,
JOBS_FILE,
)
from cron.scheduler import tick
__all__ = [
"create_job",
"get_job",
"list_jobs",
"remove_job",
"update_job",
"pause_job",
"resume_job",
"trigger_job",
"tick",
"JOBS_FILE",
]