fix(cron): add seconds support and honor sub-minute schedules - #44751
Open
bitflicker64 wants to merge 3 commits into
Open
fix(cron): add seconds support and honor sub-minute schedules#44751bitflicker64 wants to merge 3 commits into
bitflicker64 wants to merge 3 commits into
Conversation
8 tasks
teknium1
reviewed
Jul 14, 2026
teknium1
left a comment
Contributor
There was a problem hiding this comment.
Thanks for addressing the missing relative-duration path. Current main still rejects 10s in cron/jobs.py:465, so the premise is valid.
Problems
- The default trigger cannot honor the new advertised timing.
InProcessCronScheduler.start()callscron_tick()and thenstop_event.wait(interval)withinterval=60by default (cron/scheduler_provider.py:166-194). Therefore10sand30sschedules can wait until the next 60-second tick. - The added parser tests do not exercise that dispatch path, so they do not verify the requested timing guarantee.
Suggested changes
- Align the accepted schedule resolution with the built-in trigger, or add a trigger mechanism and an end-to-end timing test that can honor sub-minute jobs.
- Update
website/docs/user-guide/features/cron.md:526-540if seconds become a supported user-facing format.
Automated hermes-sweeper review.
…rom absolute timestamps - Add seconds (s/sec/secs/second/seconds) to parse_duration regex - Allow decimal values in durations (e.g. '1.5s', '0.5m') - Change return type from int to float for sub-minute precision - Update CRONJOB_SCHEMA to warn LLM against constructing ISO timestamps - Add test cases for seconds and decimal duration values Fixes NousResearch#44749
- Fix interval display to use original input string instead of computed float minutes
- Update parse_schedule docstring: minutes type int -> float
- Add integration tests: parse_schedule('every 30s'), parse_schedule('30s'), parse_schedule('1.5m')
- Fix docstring example: 0.1667 -> 10/60
- Restructure CRONJOB_SCHEMA to clearly separate ISO timestamps from relative-time warning
- Note: hermes_cli/kanban.py and plugins/google_meet/meet_bot.py have their own _parse_duration functions and are unaffected
Review on NousResearch#44751 noted that advertising 10s/30s was misleading while the built-in provider slept a fixed 60s. Shorten wait to the next job's next_run_at (capped at the default interval), recheck every second so jobs created mid-cycle still fire on time, document seconds formats, and add unit + e2e coverage for the dispatch path.
bitflicker64
force-pushed
the
fix/cron-add-seconds-support
branch
from
July 14, 2026 13:11
e9320b8 to
eff9621
Compare
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.
Summary
Fixes #44749. Relative schedules like "in 10 seconds" were broken in two places:
12:35for "now + 10s" and the job never fires.parse_durationrejected seconds. Even a correct"10s"schedule raisedValueError.This PR adds seconds support and makes the built-in ticker actually honor those schedules.
Changes
cron/jobs.pyparse_durationacceptss/sec/secs/second/seconds1.5s,0.5m)floatminutes so sub-minute precision is preservedseconds_until_next_job/compute_ticker_wait_secondsfor adaptive sleepcron/scheduler_provider.pynext_run_attools/cronjob_tools.py10s/30sDocs
website/docs/user-guide/features/cron.mddocuments seconds formats and adaptive wakeReview follow-up
Earlier feedback correctly pointed out that advertising
10swhile the ticker slept a fixed 60s could not honor the promised resolution. This update keeps the seconds parser and adds the trigger path plus an end-to-end test that a2sone-shot fires in under ~6s withinterval=60.Test plan
parse_duration("30s") == 0.5parse_duration("90seconds") == 1.5parse_schedule("every 30s")/"30s"/"1.5m"TestTickerWait(no jobs, near-term shortens wait, overdue near-zero, paused/disabled ignored)test_inprocess_provider_honors_subminute_schedule(e2e dispatch path)