Skip to content

fix(cron): skip AI call when prerun script produces no output - #19628

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-8c54fd4a
May 4, 2026
Merged

fix(cron): skip AI call when prerun script produces no output#19628
teknium1 merged 1 commit into
mainfrom
hermes/hermes-8c54fd4a

Conversation

@teknium1

@teknium1 teknium1 commented May 4, 2026

Copy link
Copy Markdown
Contributor

Salvage of #15223 onto current main.\n\n## Summary\nWhen a cron pre-run script runs successfully but produces no output (e.g. an email checker with an empty inbox), the scheduler injected 'Script ran successfully but produced no output' and still called the AI model \u2014 288 wasted API calls/day for a 5-minute interval job. Return None from and short-circuit with a SILENT_MARKER in that case.\n\n## Validation\nManual review; diff scope self-contained.\n\nOriginal PR: #15223

When a cron job has a pre-run script that runs successfully but produces
no output (e.g. email checker with no new mail), the scheduler previously
injected "[Script ran successfully but produced no output.]" into the
prompt and still called the AI model. This wastes tokens on every cycle.

Now _build_job_prompt() returns None when script output is empty, and
run_job() short-circuits with a SILENT response - zero API calls when
there is nothing to report.
@teknium1
teknium1 merged commit 54cd633 into main May 4, 2026
8 of 10 checks passed
@teknium1
teknium1 deleted the hermes/hermes-8c54fd4a branch May 4, 2026 09:32
@alt-glitch alt-glitch added type/perf Performance improvement or optimization comp/cron Cron scheduler and job management P3 Low — cosmetic, nice to have labels May 4, 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/perf Performance improvement or optimization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants