The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(cron): say which dispatch step failed in the _submit_with_guard log
kshitijk4poorf51a86411107
diff --git a/cron/scheduler.py b/cron/scheduler.pyindex 1e204111e55..c1992df141a 100644--- a/cron/scheduler.py+++ b/cron/scheduler.py@@ -4352,8 +4352,9 @@ def _submit_with_guard(job: dict, pool: concurrent.futures.ThreadPoolExecutor, pif execution is not None: # the receipt was persisted; a later step failedsettle_unstarted_execution(execution["id"], job_id, (f"Dispatch preparation failed: {type(execution_err).__name__}: {execution_err}"))- logger.exception(- "Job '%s' not dispatched: execution creation failed: %s", job_label, execution_err)+ logger.exception("Job '%s' not dispatched: %s failed: %s", job_label,+ "execution creation" if execution is None else "dispatch preparation",+ execution_err)return Nonedef _run_and_release(j=dispatched_job, ctx=_ctx, home=_claim_home):diff --git a/tests/cron/test_due_scan_save_failure.py b/tests/cron/test_due_scan_save_failure.pyindex 90193bfa802..3562c173fbb 100644--- a/tests/cron/test_due_scan_save_failure.py+++ b/tests/cron/test_due_scan_save_failure.py@@ -129,7 +129,7 @@ def test_tick_on_unwritable_store_returns_cleanly_without_dispatch(cron_store, m@pytest.mark.parametrize("site", ["claim_job_for_fire", "note_cron_execution"])-def test_dispatch_failure_after_receipt_never_leaves_it_claimed(cron_store, monkeypatch, site):+def test_dispatch_failure_after_receipt_never_leaves_it_claimed(cron_store, monkeypatch, caplog, site):"""A non-OSError fire-claim failure, or a failure after create_execution in _submit_with_guard,must settle the receipt: a ``claimed`` row never resolves and reads forever as in flight."""from cron import executions, scheduler@@ -148,3 +148,5 @@ def test_dispatch_failure_after_receipt_never_leaves_it_claimed(cron_store, monkpass # a claim failure may still surface; the receipt is what must be terminalrow = executions.latest_execution("due-job")assert row is not None and row["status"] == "failed"+ if site == "note_cron_execution": # the receipt exists, so creation did not fail+ assert "dispatch preparation failed" in caplog.text