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 fix(cron): resolve model.default + fail fast on missing model 2026-06-21 12:37:56 +05:30
test_blueprint_catalog.py
test_claim_job_for_fire.py revert(cron): return cron job storage to per-profile (reverts #32117 + #50993) (#51116) 2026-06-22 17:53:50 -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_cron_context_from.py
test_cron_direct_api_call_62151.py fix(delegation): route delegated-child API calls inline to avoid nested-pool wedge (#60203) 2026-07-26 20:37:51 -07:00
test_cron_inactivity_timeout.py
test_cron_no_agent.py
test_cron_profile_isolation.py fix(cron): make per-profile cron isolation intentional and tested (#4707) (#53570) 2026-06-27 03:55:01 -07:00
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 fix(cron): preserve POSIX script decoding defaults 2026-07-17 15:40:50 -07:00
test_cron_workdir.py fix(cron): deliver before tearing down the agent's async clients (#58720) 2026-07-06 02:05:46 +05:30
test_cronjob_schema.py
test_execution_ledger.py fix(cron): close sqlite connections deterministically in execution ledger 2026-07-24 15:55:08 -07:00
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 fix(cron): preserve jobs.json ownership on root rewrite + surface failing-tick reason 2026-07-24 15:52:13 -07:00
test_parallel_pool.py fix(cron): deliver before tearing down the agent's async clients (#58720) 2026-07-06 02:05:46 +05:30
test_reasoning_config_per_model.py feat(config): support per-model reasoning_effort overrides 2026-07-14 11:46:40 -07:00
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 fix(cron): tick every served profile's cron store under multiplex_profiles (#69377) 2026-07-24 13:50:05 +05:30
test_scheduler_shutdown_guard.py test(cron): cover the interpreter-shutdown scheduling guard (#58720) 2026-07-06 02:05:46 +05:30
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 fix(cron): resolve SessionDB timeout from config.yaml 2026-07-14 03:31:06 +05:30
test_shutdown_interrupt.py fix(cron): stop interrupted jobs from delivering their pre-kill output 2026-07-07 22:15:04 -07:00
test_suggestions.py
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 fix(cron): stop the ticker from stalling forever on a wedged jobs lock (#60703) (#60855) 2026-07-08 05:13:18 -07:00