Skip to content

The agent that grows with you

fix(cron): every slot move honours a job's pinned timezone

Teknium3dbe3ec4d87d
diff --git a/cron/AGENTS.md b/cron/AGENTS.md
index 8b63b6b5dea..cef74949615 100644
--- a/cron/AGENTS.md
+++ b/cron/AGENTS.md
@@ -28,7 +28,7 @@ Hardening invariants — each guards a real failure; don't weaken without answer
one-shots.
- **A pinned `timezone` owns the whole path, not just the compute.** `compute_next_run` resolves
*job pin → profile zone*, and every `next_run_at` write site must pass the pin (`cron/jobs.py`
- call sites, `quota_hold.plan_hold`, `unreachable_retry.will_retry`); one missed site is a burst
+ call sites, `quota_hold.plan_hold`, `unreachable_retry.will_retry`, `extra_fire.settle`); one missed site is a burst
re-run or a skipped slot. `_evaluate_due_job` normalizes the stored instant into the JOB's zone
and **skips `_repair_timezone_shifted_cron`** for pinned jobs — that repair is for jobs that
follow the profile zone, and on a pinned job its wall-clock predicate reads a due occurrence as
diff --git a/cron/extra_fire.py b/cron/extra_fire.py
index 97a0cac3896..ca5a7bcee50 100644
--- a/cron/extra_fire.py
+++ b/cron/extra_fire.py
@@ -91,4 +91,5 @@ def settle(job: dict[str, Any], now: str) -> None:
if job.get("schedule", {}).get("kind") == "once":
job["next_run_at"] = now
else:
- job["next_run_at"] = compute_next_run(job["schedule"], now) or job.get("next_run_at")
+ job["next_run_at"] = compute_next_run(
+ job["schedule"], now, timezone=job.get("timezone")) or job.get("next_run_at")
diff --git a/cron/job_definition.py b/cron/job_definition.py
index 6e1f89c7576..862eead7bb9 100644
--- a/cron/job_definition.py
+++ b/cron/job_definition.py
@@ -33,7 +33,10 @@ def merge_job_definition(local: dict[str, Any], authored: dict[str, Any]) -> dic
if isinstance(merged.get("schedule"), str):
merged["schedule"] = parse_schedule(merged["schedule"])
- if local.get("schedule") != merged.get("schedule"):
+ # A zone change moves every wall-clock occurrence exactly like an expr change: the instant on
+ # file belongs to the old zone and the next scan would re-anchor past it without firing.
+ if (local.get("schedule") != merged.get("schedule")
+ or local.get("timezone") != merged.get("timezone")):
merged.pop("pending_slot", None)
_clear_quota_hold(merged)
if is_job_runnable(merged):