Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cron/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This process-global cleanup is unsafe when due jobs run concurrently: a completed job can clear the marker while another cron job is still active, causing its approval checks to stop enforcing approvals.cron_mode. The cron marker needs per-job scoped state rather than a shared env-var lifetime.

# 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:
Expand Down