hermes - 💡(How to fix) Fix [Feature]: Add pre-execution condition check (e.g., workday detection) for cron tasks

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Fix Action

Fix / Workaround

The current cron system only supports time-based triggers. It cannot handle such dynamic "pre-conditions" natively. As a workaround, I have to use an external shell script as a "guard" with the system crontab, which splits the configuration logic and increases maintenance overhead.

Code Example

cron:
  - name: "daily_briefing"
    schedule: "0 9 * * *"
    condition: "/path/to/check-workday.sh"  # Executed as a shell command
    task: "Generate and send today's briefing"

---

cron:
  - name: "daily_briefing"
    schedule: "0 9 * * *"
    condition: "Check if today is a workday, respecting Chinese statutory holidays and compensatory working days."
    task: "Generate and send today's briefing"

---
RAW_BUFFERClick to expand / collapse

Problem or Use Case

I need to schedule tasks (e.g., daily briefing, weekly plan) that only run on actual workdays, respecting China's complex holiday and compensatory workday rules (e.g., a Saturday might be a workday due to a holiday swap, while a Sunday might be a day off).

The current cron system only supports time-based triggers. It cannot handle such dynamic "pre-conditions" natively. As a workaround, I have to use an external shell script as a "guard" with the system crontab, which splits the configuration logic and increases maintenance overhead.

Proposed Solution

I propose adding a condition field to cron jobs. This field would be evaluated before the main task executes. If the condition returns false or a non-zero exit code, the job is skipped entirely (no task execution, no notification).

To cover different use cases, the condition field could support two modes:

Option 1 (Shell Command) — Recommended for efficiency:

cron:
  - name: "daily_briefing"
    schedule: "0 9 * * *"
    condition: "/path/to/check-workday.sh"  # Executed as a shell command
    task: "Generate and send today's briefing"
  • The job is skipped if the shell command exits with a non-zero code.
  • Zero token cost, fast, deterministic.

Option 2 (Natural Language) — For complex, knowledge-based rules:

cron:
  - name: "daily_briefing"
    schedule: "0 9 * * *"
    condition: "Check if today is a workday, respecting Chinese statutory holidays and compensatory working days."
    task: "Generate and send today's briefing"
  • The Agent evaluates the natural language statement via a lightweight LLM call.
  • Skipped if the statement evaluates to false.

Optional enhancement: Allow both to be combined (e.g., run shell command first; if it's not available or returns an "unknown" code, fall back to LLM evaluation).

This design gives users flexibility: deterministic checks via shell, intelligent checks via LLM, or a hybrid approach.

Alternatives Considered

No response

Feature Type

Configuration option

Scope

None

Contribution

  • I'd like to implement this myself and submit a PR

Debug Report (optional)

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix [Feature]: Add pre-execution condition check (e.g., workday detection) for cron tasks