hermes-agent/tests/cron
kshitijk4poor cff9728587 fix(cron): record failure for BaseException escapes and leave a diagnostic when removing wedged one-shots
Fixes #73973.

A finite one-shot whose dispatch was claimed (claim_dispatch increments
repeat.completed BEFORE execution) but whose run died before mark_job_run
was left permanently wedged: completed==times, last_run_at null, state
'scheduled'. The run-claim TTL blocked re-dispatch, and once it expired
the dispatch-limit guard silently removed the job with no output and no
error.

Two complementary fixes:

- cron/scheduler.py run_one_job: the outer handler now catches
  BaseException, not just Exception. The inner run_job handler re-raises
  CancelledError/KeyboardInterrupt/SystemExit after agent teardown, and
  none of those are Exception subclasses, so the outer 'except Exception'
  missed them and mark_job_run(False) was never called. Failures are now
  recorded first (mark_job_run + finish_execution, each independently
  guarded), then non-Exception BaseExceptions are re-raised to preserve
  teardown semantics. Plain Exceptions keep the existing behavior
  (recorded, return False, no re-raise). Empty str(e) (bare
  CancelledError) falls back to the exception class name.

- cron/jobs.py: when either removal site (claim_dispatch or the
  get_due_jobs dispatch-limit guard) drops a one-shot whose claimed run
  never completed (last_run_at null), _write_wedged_oneshot_diagnostic
  now writes an operator-visible .md into cron/output/<job_id>/ instead
  of vanishing silently. Best-effort: diagnostics can never break the
  removal. No diagnostic when last_run_at is set (normal completion
  race).
2026-07-29 20:16:57 +05:30
..
__init__.py
…
conftest.py
…
test_blueprint_catalog.py
…
test_claim_job_for_fire.py
…
test_codex_execution_paths.py
…
test_compute_next_run_last_run_at.py
…
test_cron_context_from.py
…
test_cron_direct_api_call_62151.py
…
test_cron_inactivity_timeout.py
…
test_cron_no_agent.py
…
test_cron_profile_isolation.py
…
test_cron_prompt_injection_skill.py
…
test_cron_provider_pin.py feat(cron): user-owned model pins + cron.model fleet default 2026-07-28 11:52:47 -07:00
test_cron_script.py
…
test_cron_workdir.py
…
test_cronjob_schema.py
…
test_execution_ledger.py
…
test_file_permissions.py
…
test_jobs.py fix(cron): record failure for BaseException escapes and leave a diagnostic when removing wedged one-shots 2026-07-29 20:16:57 +05:30
test_jobs_changed_notify.py
…
test_jobs_crossprocess_lock.py
…
test_jobs_file_ownership.py
…
test_parallel_pool.py
…
test_reasoning_config_per_model.py
…
test_rewrite_skill_refs.py
…
test_run_one_job.py fix(cron): record failure for BaseException escapes and leave a diagnostic when removing wedged one-shots 2026-07-29 20:16:57 +05:30
test_scheduler.py test: isolate delegated and Photon environment state 2026-07-28 18:17:52 -07:00
test_scheduler_mcp_init.py
…
test_scheduler_provider.py
…
test_scheduler_shutdown_guard.py
…
test_script_claim_heartbeat.py
…
test_sessiondb_init_hang.py
…
test_shutdown_interrupt.py
…
test_suggestions.py
…
test_terminal_cwd_lock.py
…
test_ticker_stall_60703.py
…