Skip to content

The agent that grows with you

refactor(cron): gate imported schedule changes on is_job_runnable

kshitijk4poorb0aefcce7033
diff --git a/cron/job_definition.py b/cron/job_definition.py
index 2deccd8aea7..96560ef43be 100644
--- a/cron/job_definition.py
+++ b/cron/job_definition.py
@@ -6,7 +6,7 @@ into a live one (profile distributions) import this rather than duplicating the
"""
from typing import Any, Dict
-from cron.jobs import _apply_schedule_update, _jobs_lock, load_jobs, parse_schedule, save_jobs
+from cron.jobs import _apply_schedule_update, _jobs_lock, is_job_runnable, load_jobs, parse_schedule, save_jobs
from cron.quota_hold import clear_state as _clear_quota_hold
from hermes_time import now as _hermes_now
@@ -35,7 +35,7 @@ def merge_job_definition(local: Dict[str, Any], authored: Dict[str, Any]) -> Dic
if local.get("schedule") != merged.get("schedule"):
merged.pop("pending_slot", None)
_clear_quota_hold(merged)
- if merged.get("enabled", True) and merged.get("state") != "paused":
+ if is_job_runnable(merged):
updates = {"schedule": merged["schedule"]}
if "schedule_display" in authored:
updates["schedule_display"] = authored["schedule_display"]