Skip to content

The agent that grows with you

fix(cron): report ownerless interrupted fires so their notices still send

Teknium5ecad87d1eb3
diff --git a/cron/scheduler.py b/cron/scheduler.py
index 0ba5ca804e7..fb801fee28c 100644
--- a/cron/scheduler.py
+++ b/cron/scheduler.py
@@ -957,6 +957,12 @@ def mark_running_jobs_interrupted(
"leaving persisted state untouched",
job_id,
)
+ # Still report the interruption to the caller: the gateway
+ # shutdown path uses the returned IDs to send the
+ # interrupted-cron notice while adapters are still connected
+ # (#82232). The in-memory interrupt flag WAS recorded above —
+ # only the persisted last_status write is skipped here.
+ marked.append(job_id)
continue
try:
with use_cron_store(profile_home):
diff --git a/tests/gateway/test_cron_interrupt_notification.py b/tests/gateway/test_cron_interrupt_notification.py
index 91a73093120..bde4738c204 100644
--- a/tests/gateway/test_cron_interrupt_notification.py
+++ b/tests/gateway/test_cron_interrupt_notification.py
@@ -220,10 +220,10 @@ class TestDeliveryErrorIsRecordedWhenTheNoticeCannotBeSent:
import cron.scheduler as sched
- src = inspect.getsource(sched.run_one_job)
+ src = inspect.getsource(sched._run_one_job_body)
assert 'update_job(job["id"], {"last_delivery_error": delivery_error})' in src, (
"interrupted runs must still persist the delivery failure"
)
# The recovery branch hangs off the interrupted-flag short-circuit,
# not off a second mark_job_run call.
- assert "elif delivery_error:" in src
+ assert "if interrupted:" in src and "if delivery_error:" in src