From e9a01046ebf686e4feffc51bd930e21afad004ef Mon Sep 17 00:00:00 2001 From: kshitijk4poor <82637225+kshitijk4poor@users.noreply.github.com> Date: Sat, 26 Sep 2026 19:23:12 +0530 Subject: [PATCH] fix(cron): label post-handoff external-worker failures distinctly run_one_job's dispatch-failure handler already routes an _ExternalWorkerPostHandoffError through bookkeeping only (no incident, no ping), but the recorded error still read "Restart-safe cron worker dispatch failed", which is misleading in last_error / executions.db for a worker that was spawned and may have run. Compute post_handoff first and label it "Restart-safe cron worker failed after handoff: ..."; the pre-handoff prefix is unchanged. --- cron/scheduler.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cron/scheduler.py b/cron/scheduler.py index 2d918fb1f8..a22815f389 100644 --- a/cron/scheduler.py +++ b/cron/scheduler.py @@ -2726,14 +2726,15 @@ def run_one_job( if _launch_external_cron_worker(job): return True except Exception as handoff_error: - error = f"Restart-safe cron worker dispatch failed: {handoff_error}" - logger.error("Job '%s': %s", job["id"], error) - claim = job.get("fire_claim") - owner = str(claim.get("by") or "") if isinstance(claim, dict) else "" # Past the handoff the worker may have adopted the row, run side effects # and sent its own notice: record bookkeeping only, never a false # "dispatch failed" incident/ping. post_handoff = isinstance(handoff_error, _ExternalWorkerPostHandoffError) + stage = "failed after handoff" if post_handoff else "dispatch failed" + error = f"Restart-safe cron worker {stage}: {handoff_error}" + logger.error("Job '%s': %s", job["id"], error) + claim = job.get("fire_claim") + owner = str(claim.get("by") or "") if isinstance(claim, dict) else "" delivery_error = delivery_outcome = None try: # A pre-handoff dispatch failure is a job failure like any other: it