From b8c18b8cb779b45f78281e9a542058e650fd87b9 Mon Sep 17 00:00:00 2001 From: ghosty93 <64233280+ghosty93@users.noreply.github.com> Date: Sun, 23 Aug 2026 15:08:21 +0300 Subject: [PATCH] docs(cron): explain why the secret-scope reset must stay function-level MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Review follow-up: the comment records that the reset scopes delivery, deferred-agent teardown, claim-loss handling and bookkeeping, and that an earlier inner-finally placement left _deliver_result unscoped — so a tidy-up does not silently reintroduce the bug. --- cron/scheduler.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cron/scheduler.py b/cron/scheduler.py index 575d60b26c..dd385db12e 100644 --- a/cron/scheduler.py +++ b/cron/scheduler.py @@ -7618,6 +7618,10 @@ def _run_one_job_body( raise return False finally: + # Function-level on purpose: this must scope delivery, deferred-agent + # teardown, claim-loss handling and bookkeeping, not just run_job. + # An earlier revision reset inside the run block's finally, which left + # _deliver_result unscoped — do not move it back in a tidy-up. if _scope_token is not None: reset_secret_scope(_scope_token)