Skip to content

Add script_skip_if_empty for cron jobs with pre-run scripts - #10855

Closed
cola-runner wants to merge 2 commits into
NousResearch:mainfrom
cola-runner:codex/fix-10656-cron-skip-empty-script
Closed

cola-runner wants to merge 2 commits into
NousResearch:mainfrom
cola-runner:codex/fix-10656-cron-skip-empty-script

Conversation

@cola-runner

Copy link
Copy Markdown
Contributor

This adds an opt-in script_skip_if_empty flag for cron jobs with pre-run scripts.

Right now a cron job always goes on to invoke the LLM after the script runs, even when the script exits successfully with empty stdout. That makes change-detection style jobs noisy and wastes model calls when there is nothing to report.

With this change:

  • cron jobs can store script_skip_if_empty: true
  • if the script exits successfully and stdout is empty, run_job() returns early without creating an AIAgent
  • delivery is automatically suppressed because the returned final_response is empty
  • the run is still treated as successful, and the saved output log makes it clear that execution was skipped because the script produced no output

The default behavior is unchanged. If the flag is not set, empty script output still follows the existing path and the LLM receives the "no output" notice in the prompt.

The change is wired through all three layers:

  • cron/jobs.py stores the flag on the job
  • cron/scheduler.py performs the early skip and avoids running the script twice
  • tools/cronjob_tools.py exposes the flag on create/update/list

I also added regression coverage for:

  • job storage of the new field
  • create/update/list behavior in the cronjob tool
  • the scheduler short-circuit path where the script succeeds with empty output and the LLM should not run

Testing

  • source venv/bin/activate && python -m pytest tests/cron/test_cron_script.py -q
  • source venv/bin/activate && python -m pytest tests/cron/test_scheduler.py -q
  • source venv/bin/activate && python -m pytest tests/tools/test_cronjob_tools.py -q
  • source venv/bin/activate && python -m pytest tests/ -q

The targeted cron tests pass.

The full local suite is still not green on this checkout/environment (68 failed, 11771 passed, 98 skipped, 60 errors), but the failures are outside this change and match the broader ACP / optional Discord / web-server / gateway noise already present locally.

@cola-runner
cola-runner marked this pull request as ready for review April 16, 2026 08:06
@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 Apr 25, 2026
@alt-glitch

Copy link
Copy Markdown
Contributor

Competes with #15223 and #9300 (same feature). Merged #12373 (wakeAgent gate) may partially overlap. Implements #10656.

@alt-glitch

Copy link
Copy Markdown
Contributor

Competes with #15223 and #9300

@alt-glitch alt-glitch mentioned this pull request Apr 25, 2026
23 tasks
@cola-runner
cola-runner force-pushed the codex/fix-10656-cron-skip-empty-script branch from 16aabe3 to 7db02d7 Compare April 27, 2026 03:06
@teknium1

Copy link
Copy Markdown
Collaborator

Thanks for the focused cron work. This is already implemented on current main by a stronger default behavior rather than a per-job opt-in flag.

  • Automated hermes-sweeper review verified cron/scheduler.py:2201-2203: successful empty pre-run output returns None from _build_job_prompt.
  • cron/scheduler.py:2672-2674 converts that result to SILENT_MARKER before an AIAgent is constructed, which suppresses delivery.
  • This landed in 54cd633366cf51810e2efc31e228a5774556b3c3 (fix(cron): skip AI call when script produces no output) and shipped in v2026.5.7.
  • The prior maintainer note correctly identified overlap with the merged wakeAgent gate; current main additionally covers the empty-stdout case directly.

@teknium1 teknium1 closed this Jul 12, 2026
@teknium1 teknium1 added sweeper:implemented-on-main Sweeper: behavior already present on current main sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 12, 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 sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:implemented-on-main Sweeper: behavior already present on current main type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants