A running cron job keeps its past next_run_at until it finishes. The timer uses that timestamp to wake every 0.1 seconds, although dispatch correctly skips the job. With a 60-second tick interval, a local reproduction recorded six empty ticks in 650 ms.
Exclude running and completed jobs when choosing the next timer deadline, matching the dispatch filter. Other scheduled jobs still determine the next wake-up.
Validation: four regression cases failed before the fix; all 102 cron tests passed afterward. The same timer reproduction produced zero empty ticks after the fix. Changed-file pre-commit passed. Full-repo pre-commit still reports existing main failures, including ms_agent/config/skills_manager.py:61 and ms_agent/permission/shell_validator.py:91.
Related issue number
None; found while checking cron scheduling.
Checklist
The pull request title is a good summary of the changes - it will be used in the changelog
Unit tests for the changes exist
Run pre-commit install and pre-commit run --all-files before git commit, and passed lint check. Full-repo failures noted above.
Documentation reflects the changes where applicable (no new command or configuration)
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
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.
Change Summary
A running cron job keeps its past next_run_at until it finishes. The timer uses that timestamp to wake every 0.1 seconds, although dispatch correctly skips the job. With a 60-second tick interval, a local reproduction recorded six empty ticks in 650 ms.
Exclude running and completed jobs when choosing the next timer deadline, matching the dispatch filter. Other scheduled jobs still determine the next wake-up.
Validation: four regression cases failed before the fix; all 102 cron tests passed afterward. The same timer reproduction produced zero empty ticks after the fix. Changed-file pre-commit passed. Full-repo pre-commit still reports existing main failures, including ms_agent/config/skills_manager.py:61 and ms_agent/permission/shell_validator.py:91.
Related issue number
None; found while checking cron scheduling.
Checklist