fix(cron): avoid consuming skipped manual triggers - #43091
Closed
pjbeyer wants to merge 2 commits into
Closed
Conversation
Contributor
Code Review: VerificationReviewed by: automated PR review This PR is clean — no substantive issues found. What it does: Moves Assessment:
Well-scoped concurrency fix with clear before/after semantics. |
pjbeyer
force-pushed
the
fix/cron-manual-trigger-guard
branch
from
June 18, 2026 12:13
0a0fc8c to
ad227f6
Compare
Adopt the layered cross-agent context model: CLAUDE.md imports AGENTS.md via @-import so Claude Code, Codex, and OpenCode read one canonical source with no manual sync. bd manages its block in AGENTS.md; do not run 'bd setup claude' here. Coding-Agent: Claude Code
Contributor
|
Thanks for the focused regression analysis. This is an automated hermes-sweeper review; current
Closing as implemented on main. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes a cron scheduler edge case where a due/manual-triggered job can be silently consumed when the in-process running guard already contains that job ID.
Previously,
tick()advancednext_run_atfor every due job before checking_running_job_ids. If the guard then skipped a job as already running, the job did not execute,last_run_atdid not change, butnext_run_athad already moved forward. That made manualcron runtriggers appear accepted while the job was skipped until a later schedule.This PR moves
advance_next_run(job_id)inside_submit_with_guard()after the running guard accepts the job and before the worker starts. Skipped jobs remain due, so manual triggers are not consumed without execution or visible skipped/already-running status. Accepted jobs keep the existing at-most-once behavior, andmark_job_run()still overwritesnext_run_aton completion.Related Issue
No public issue number.
Related/overlapping upstream work:
cronjob(action="run")immediate execution and skipped-run visibility)Type of Change
Changes Made
cron/scheduler.pynext_run_atonly after_running_job_idsaccepts the job.tests/cron/test_scheduler.pytick()does not calladvance_next_run()orrun_job()for skipped jobs.How to Test
Run the specific regression test:
uv run python -m pytest tests/cron/test_scheduler.py::TestRunJobSessionPersistence::test_tick_does_not_advance_skipped_already_running_job -q -o 'addopts='Run the scheduler test file with the project wrapper:
Run the cron test package:
uv run python -m pytest tests/cron -q -o 'addopts='Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — N/A, focused scheduler bug fix covered by code comments + regression testcli-config.yaml.exampleif I added/changed config keys — N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — N/AScreenshots / Logs