From f8639aed98703c7315bd785e658efabfc0481d22 Mon Sep 17 00:00:00 2001 From: kshitijk4poor <82637225+kshitijk4poor@users.noreply.github.com> Date: Tue, 6 Oct 2026 09:36:17 +0530 Subject: [PATCH] refactor(cron): import _claim_owner_is_dead at module level in jobs.py The late import in _claim_is_live was only there because the helper moved to scheduler_ownership; that module's top-level imports never reach cron.jobs, so there is no cycle. A function-level cron.* import inside jobs.py is a first-time import on the completion tail, which #133407's generation-pinning guard (test_completion_tail_imports[jobs.py]) rejects once both land. --- cron/jobs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cron/jobs.py b/cron/jobs.py index be9b49ceba..29dcfe6e54 100644 --- a/cron/jobs.py +++ b/cron/jobs.py @@ -31,6 +31,7 @@ from pathlib import Path from hermes_constants import get_hermes_home from cron.constants import CLAIM_TTL_INACTIVITY_HEADROOM, FIRE_CLAIM_SKEW_SECONDS, FIRE_CLAIM_TTL_SECONDS from cron.env_settings import cron_env_setting +from cron.scheduler_ownership import _claim_owner_is_dead from typing import Optional, Dict, List, Any, Callable, Set, Tuple, Union, Collection logger = logging.getLogger(__name__) @@ -2261,7 +2262,6 @@ def _claim_is_live(claim: Any, now: datetime, ttl_seconds: float) -> bool: claimed_at = _parse_aware(claim["at"]) if claimed_at is None or not (0 <= _elapsed_seconds(now, claimed_at) < ttl_seconds): return False - from cron.scheduler_ownership import _claim_owner_is_dead return not _claim_owner_is_dead(claim)