diff --git a/cron/scheduler.py b/cron/scheduler.py index 4c764bd13a445..b58b32bc28cf6 100644 --- a/cron/scheduler.py +++ b/cron/scheduler.py @@ -3031,6 +3031,9 @@ def run_job(job: dict) -> tuple[bool, str, str, Optional[str]]: os.environ.pop("TERMINAL_CWD", None) else: os.environ["TERMINAL_CWD"] = _prior_terminal_cwd + # Remove the process-wide cron sentinel so it does not leak into + # interactive gateway sessions running in the same process (#56771). + os.environ.pop("HERMES_CRON_SESSION", None) # Release the cwd lock now that the env is restored, so a waiting # workdir job (or queued reader) can proceed without seeing the override. if _holds_cwd_write: