hermes-agent/tests/cron
Teknium d1afa16053 fix(cron): retain completed one-shot jobs instead of deleting them on completion
mark_job_run popped a finite one-shot from jobs.json the moment its
repeat limit was reached and returned early — discarding the
last_status / last_error / last_delivery_error it had just written.
Every finished one-shot vanished from `cronjob action=list` with no
inspectable record, and a delivery failure (agent succeeded, platform
send failed) was silently thrown away with it.

Changes:
- mark_job_run now retires a limit-reached one-shot as a terminal
  record (state="completed", enabled=False, next_run_at=None) —
  mirroring the existing next_run_at-is-None terminal branch — so the
  final status and any delivery error persist and surface in the
  cronjob tool's list output (which already emits last_delivery_error
  and defaults to include_disabled=True).
- claim_dispatch's stale-job cleanup marks already-ran jobs completed
  instead of popping them; genuinely wedged claims (last_run_at never
  written) are still removed with the operator-visible diagnostic.
- Retention sweep in the due scan prunes completed one-shot records
  older than cron.completed_retention_days (default 7; non-positive
  disables) so jobs.json cannot grow unboundedly. Recurring jobs and
  non-terminal one-shots are never candidates.

Tests: completion retains record + delivery error, list surfaces it,
completed jobs never re-dispatch, sweep prunes old / keeps recent /
ignores recurring / honors the disable knob; recurring lifecycle
unchanged.
2026-08-02 23:12:00 -07:00
..
__init__.py
conftest.py fix(cron): scope cron approval context per session 2026-08-03 00:25:20 +05:30
test_blueprint_catalog.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_claim_job_for_fire.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_codex_execution_paths.py test(cron): accept target_model kwarg in codex-path resolver stub 2026-07-19 09:57:21 -07:00
test_compute_next_run_last_run_at.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_cron_context_from.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_cron_direct_api_call_62151.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_cron_inactivity_timeout.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_cron_no_agent.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_cron_profile_isolation.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_cron_prompt_injection_skill.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_cron_provider_pin.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_cron_script.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_cron_workdir.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_cronjob_schema.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_execution_ledger.py perf(cron): batch advance_next_run for the due-dispatch loop 2026-08-02 21:15:16 +05:30
test_file_permissions.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_jobs.py fix(cron): retain completed one-shot jobs instead of deleting them on completion 2026-08-02 23:12:00 -07:00
test_jobs_changed_notify.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_jobs_crossprocess_lock.py fix: complete cron jobs lock salvage 2026-06-15 06:29:00 -07:00
test_jobs_file_ownership.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_parallel_pool.py perf(cron): batch advance_next_run for the due-dispatch loop 2026-08-02 21:15:16 +05:30
test_reasoning_config_per_model.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_rewrite_skill_refs.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_run_one_job.py perf(cron): batch advance_next_run for the due-dispatch loop 2026-08-02 21:15:16 +05:30
test_scheduler.py perf(cron): batch advance_next_run for the due-dispatch loop 2026-08-02 21:15:16 +05:30
test_scheduler_cron_session_isolation.py fix(cron): scope cron approval context per session 2026-08-03 00:25:20 +05:30
test_scheduler_mcp_init.py
test_scheduler_provider.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_scheduler_shutdown_guard.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_script_claim_heartbeat.py fix: update heartbeat test stubs to accept workdir kwarg 2026-07-24 15:55:39 -07:00
test_sessiondb_init_hang.py perf(cron): batch advance_next_run for the due-dispatch loop 2026-08-02 21:15:16 +05:30
test_shutdown_interrupt.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_suggestions.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_terminal_cwd_lock.py fix(cron): release TERMINAL_CWD lock even when run_job body raises 2026-07-01 15:39:48 +05:30
test_ticker_stall_60703.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00