Repository navigation
Scatter every N days/weeks/months schedules to avoid pile-ups - #78779
Conversation
'every N days' compiled to a fixed '0 0 */N * *', so 63 workflows (mostly smoke tests) fired in the same minute at 00:00 UTC. Day, week and month intervals now emit fuzzy tokens (FUZZY:DAILY_INTERVAL/N, FUZZY:MONTHLY_INTERVAL/N) that scatter to a hashed time per workflow. Docs updated, including the 'every N minutes' row (already fuzzy). Co-authored-by: Copilot App <[email protected]>
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ Ponytail Reviewer completed successfully! Ponytail ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
This comment has been minimized.
This comment has been minimized.
|
✅ PR Code Quality Reviewer completed the code quality review. PR Code Quality ReviewerOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ PR Specification Reviewer completed successfully!
|
🏗️ Design Decision Gate — ADR RequiredThis PR makes significant changes to core business logic (134 added lines under 📄 Draft ADR committed:
📋 What to do next
Once an ADR is linked in the PR body, this gate re-runs and checks that the implementation matches the decision.
|
There was a problem hiding this comment.
Reviewed head 28f05ae7c5cfcf778b9d74ff53e557cee5610700 against the fuzzy schedule specification (v1.2.0, §3.6 and interval conformance tests).
Blocking finding: the new monthly/weekly interval contract claims every <N> <unit> support, but the parser still rejects long-form weeks/months and no conformance evidence covers those forms. See the inline comment on the changed specification line. Please align the specification with implemented syntax or add parser support and tests.
Coverage: static specification review only; tests were not run per review policy.
Generated by PR Specification Reviewer for #78779 · copilot · gpt50 · ~4 AIC · ⌖ ~2 AIC · ⊞ 1.6K
Comment /review-specs to run again
| - Hours: `FUZZY:HOURLY/N * * *` (scattered minute) | ||
| - Days: `FUZZY:DAILY * * *` for N=1; otherwise `FUZZY:DAILY_INTERVAL/N * * *`, scattered to `M H */N * *` | ||
| - Weeks: `FUZZY:WEEKLY * * *` for N=1; otherwise `FUZZY:DAILY_INTERVAL/(N*7) * * *`, scattered to `M H */(N*7) * *` | ||
| - Months: `FUZZY:MONTHLY_INTERVAL/N * * *`, scattered to `M H D * *` (N=1) or `M H D */N *`, with a hashed day of month `D` in `[1, 28]` |
There was a problem hiding this comment.
This new normative row is not implementable for the documented interval syntax. Section 3.6 defines every <N> <unit> and lists weeks, but parseLongIntervalParts still accepts only minutes, hours, and days (pkg/parser/schedule_parser.go:241-247), so every 2 weeks is rejected; long-form months are likewise unsupported. The implementation only handles every 2w/every 2mo. Please either add parser support and conformance tests for the long forms, or limit this contract to the supported abbreviations instead of claiming all interval forms.
There was a problem hiding this comment.
Fixed in 88d824c: the specification now distinguishes long-form minute/hour/day units from attached short units and explicitly requires w/mo for weeks/months. The reference and changeset use the supported spellings.
Comment MemoryPeek at saved memory (pr-code-quality-reviewer)Note This comment is managed by comment memory.Expand the saved memory block to view or edit the persistent context for this thread.
|
There was a problem hiding this comment.
Found two compatibility regressions in the interval compiler. every 1w now hashes the weekday instead of preserving Sunday, and every 1mo now hashes the day instead of preserving the first of the month. These alter existing workflow calendar semantics on recompilation, not just execution time. Inline comments provide details and suggested fixes.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~6 AIC · ⌖ ~1 AIC · ⊞ 1.5K
Comment /review to run again
| return "0 0 1 * *" | ||
| } | ||
| return fmt.Sprintf("0 0 1 */%d *", interval) | ||
| return fmt.Sprintf("FUZZY:MONTHLY_INTERVAL/%d * * *", interval) |
There was a problem hiding this comment.
every 1mo previously compiled to the first day of each month (0 0 1 * *), but handleMonthlyInterval now hashes the day to 1–28. This changes the calendar date for every existing monthly workflow on recompilation, beyond merely scattering its time. Please preserve day 1 for the one-month interval (or explicitly document and test this breaking semantic change).
There was a problem hiding this comment.
88d824c explicitly documents the intentional first-of-month → hashed day 1–28 migration in the reference, changeset, and ADR, with a raw-cron migration example. Added a parser-to-scatter regression test for every 1mo; focused schedule tests pass.
| func formatWeeklyIntervalCron(interval int) string { | ||
| if interval == 1 { | ||
| return "0 0 * * 0" | ||
| return "FUZZY:WEEKLY * * *" |
There was a problem hiding this comment.
every 1w previously compiled to 0 0 * * 0 (Sunday), but this now routes through FUZZY:WEEKLY, whose scatter handler hashes the weekday per workflow. Recompiling an existing workflow therefore changes not only the time but also its day-of-week, which can materially alter execution cadence and maintenance windows. Please preserve Sunday for this interval (scatter only the time) or explicitly document this compatibility change in the changeset and schedule docs.
There was a problem hiding this comment.
88d824c documents the intentional Sunday → hashed weekday migration in the reference, changeset, and ADR. It recommends weekly on sunday when Sunday must be preserved and adds parser-to-scatter coverage for every 1w.
Comment MemoryPeek at saved memory (spec-review-history)History |
Comment MemoryPeek at saved memory (review-history)History |
There was a problem hiding this comment.
🟡 Changes recommended
Two existing tests remain broken: the atomic smoke contract still expects the old cron, and the work-queue integration test omits the workflow identifier required to resolve the fuzzy schedule.
2 open issues
What changed in this PR
This PR extends gh-aw’s deterministic schedule scattering to day, week, and month intervals, reducing simultaneous workflow starts at midnight.
Changes:
- Emit fuzzy interval tokens and resolve them into scattered cron schedules.
- Update parser tests, compiler test setup, schedule documentation, and release notes.
- Regenerate 64 workflow lock files with distributed execution times.
| File | Description |
|---|---|
pkg/workflow/compiled_lock_files_test.go |
Supplies identifiers for fuzzy schedule compilation. |
pkg/parser/schedule_parser.go |
Emits fuzzy day, week, and month interval tokens. |
pkg/parser/schedule_parser_test.go |
Updates expected interval tokens. |
pkg/parser/schedule_fuzzy_scatter.go |
Adds daily and monthly interval scattering. |
pkg/parser/schedule_fuzzy_scatter_test.go |
Tests interval output, distribution, and bounds. |
docs/src/content/docs/specs/fuzzy-schedule-specification.md |
Specifies fuzzy interval behavior. |
docs/src/content/docs/reference/schedule-syntax.md |
Updates interval examples and compatibility guidance. |
.github/workflows/smoke-workflow-call.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-workflow-call-with-inputs.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-work-queue.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-update-cross-repo-pr.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-test-tools.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-temporary-id.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-service-ports.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-repo-memory-ledger.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-pydantic.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-project.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-pi.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-pi-routed.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-pi-routed-claude.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-pi-auto.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-otel-backends.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-opencode.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-multi-pr.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-kiro.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-goose.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-github-claude.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-gemini.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-drive.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-deepseek-harness.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-cursor.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-crush.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-create-cross-repo-pr.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-copilot.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-copilot-sub-agents.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-copilot-small.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-copilot-sdk.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-copilot-sdk-routed.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-copilot-sdk-routed-claude.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-copilot-routed.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-copilot-routed-steering.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-copilot-routed-claude.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-copilot-mai.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-copilot-auto.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-copilot-arm.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-copilot-aoai-entra.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-copilot-aoai-apikey.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-codex.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-codex-routed.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-codex-routed-openai.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-codex-bare-auto.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-codex-auto.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-claude.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-claude-routed.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-claude-routed-anthropic.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-claude-on-copilot.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-claude-copilot-auto.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-claude-auto.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-checkout-pr-dispatch.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-call-workflow.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-builtin-ledgers.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-azure-pi.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-azure-codex.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-atomic.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-aider.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-agent-scoped-approved.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-agent-public-none.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-agent-public-approved.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-agent-all-none.lock.yml |
Scatters the two-day schedule. |
.github/workflows/smoke-agent-all-merged.lock.yml |
Scatters the two-day schedule. |
.github/workflows/chaos-pr-bundle-fuzzer.lock.yml |
Scatters the seven-day schedule. |
.changeset/scatter-day-week-month-intervals.md |
Records the minor release and recompilation impact. |
Review effort: Balanced (adaptive)
| on: | ||
| schedule: | ||
| - cron: "0 0 */2 * *" # Friendly format: every 2 days | ||
| - cron: "51 16 */2 * *" # Friendly format: every 2 days (scattered) |
There was a problem hiding this comment.
Fixed in 88d824c: the contract now expects the regenerated 51 16 */2 * * schedule. TestAtomicSmokeContract passes.
| return "FUZZY:DAILY * * *" | ||
| } | ||
| return fmt.Sprintf("0 0 */%d * *", interval) | ||
| return fmt.Sprintf("FUZZY:DAILY_INTERVAL/%d * * *", interval) |
There was a problem hiding this comment.
Fixed in 88d824c by supplying WithWorkflowIdentifier("smoke-work-queue"). go test -tags integration ./pkg/workflow -run '^TestWorkQueueSmokeVerification$' -count=1 passes.
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /codebase-design, /diagnosing-bugs, and /grill-with-docs. Scatter logic and handler ordering look correct: handleDailyInterval is registered before handleDaily, and the monthly day is hashed into [1, 28]. Targeted parser tests pass, and the committed smoke-copilot lock cron matches compiler output.
📋 Key Themes & Highlights
Key Themes
- Behavior change for
every 1w: it now hashes to a weekday instead of Sunday midnight. Confirm this is intended. - Identifier dependency:
every N daysnow needs a workflow identifier, likedaily. Confirm the CLI parse paths set one. - Docs example: the
every 1wandevery 2wcron examples read as fixed output. Mark them as illustrative.
Positive Highlights
- ✅ Clear ordering comment at the handler registration site
- ✅ New
TestScatterScheduleDailyIntervalandTestScatterScheduleMonthlyIntervalpin the*/Nday field and the day-of-month range - ✅ Changeset documents the one-time recompile cron change and the
cron:escape hatch
@copilot please address the review comments above.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~8 AIC · ⌖ ~2 AIC · ⊞ 6.7K
Comment /matt to run again
| func formatWeeklyIntervalCron(interval int) string { | ||
| if interval == 1 { | ||
| return "0 0 * * 0" | ||
| return "FUZZY:WEEKLY * * *" |
There was a problem hiding this comment.
[/codebase-design] every 1w now emits FUZZY:WEEKLY, which hashes to a weekday instead of Sunday midnight. The changeset documents the change, but existing workflows will move to a different weekday on recompile. Confirm the weekday change is intended. The parser test checks the FUZZY:WEEKLY token, but nothing pins the resulting weekday.
@copilot please address this.
There was a problem hiding this comment.
The weekday scattering is intentional. 88d824c adds parser-to-scatter coverage asserting the identifier-hashed weekday and documents the calendar migration and weekly on sunday alternative in the reference, changeset, and ADR.
|
|
||
| // Day, week, and month intervals compile to fuzzy schedules so that many workflows | ||
| // sharing the same interval do not all fire at 00:00 UTC. | ||
| func formatDailyIntervalCron(interval int) string { |
There was a problem hiding this comment.
[/diagnosing-bugs] every N days now emits FUZZY:DAILY_INTERVAL/N, which only resolves when a workflow identifier is set. Parsing without one now fails for every 2 days with the same error as daily, where it previously compiled to a fixed cron. Confirm that CLI paths such as mcp inspect, graders run, and dispatch never parse user schedules without an identifier, or set the identifier on those paths.
💡 Reproduction
With schedule: every 2 days and no identifier, NewCompiler().ParseWorkflowFile returns fuzzy cron expression FUZZY:DAILY_INTERVAL/2 * * * requires a workflow identifier.
@copilot please address this.
There was a problem hiding this comment.
Confirmed these paths omitted identifiers. Fixed in 88d824c: both MCP inspection paths, grader definition loading, and both parsed-file dispatch/call dependency loaders now supply workflow identifiers. Added scheduled-workflow regressions for MCP inspection and grader loading; focused tests pass.
| schedule: every 1w # 0 0 * * 0 (Sunday midnight) | ||
| schedule: every 2w # 0 0 */14 * * | ||
| # Weeks (fuzzy - scattered time) | ||
| schedule: every 1w # 43 5 * * 1 (same as weekly) |
There was a problem hiding this comment.
[/grill-with-docs] These example crons are illustrative only. The real weekday and time come from a hash of the workflow identifier, so 43 5 * * 1 will not match what a given workflow compiles to. Add a note such as "example; actual weekday and time depend on the workflow identifier" so readers do not treat it as fixed output.
@copilot please address this.
There was a problem hiding this comment.
Fixed in 88d824c: the interval reference explicitly labels the crons as illustrative and states that actual times, weekdays, and monthly dates depend on the workflow identifier.
|
@copilot run pr-finisher skill |
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Ran PR-finisher and pushed 88d824c: fixed the smoke tests and missing CLI workflow identifiers, added regressions, and clarified syntax/calendar migration docs. Replied to all eight review threads. Focused tests, impacted unit tests, and Not yet merge-ready: thread resolution needs an authenticated maintainer/tool, the draft ADR still needs acceptance and a link in the PR body, and CI on the new HEAD is unverified until a maintainer re-triggers it. No merge performed. |
|
🎉 This pull request is included in a new release. Release: |

every N dayscompiled to a fixed0 0 */N * *. As a result, 63 workflows (62 of them smoke tests) usingevery 2 daysall fired in the same minute at 00:00 UTC. That pile-up is exactly what fuzzy scheduling is meant to avoid.every 7 days(chaos-pr-bundle-fuzzer) had the same problem.Root cause
In
pkg/parser/schedule_parser.go, the cron builders for day, week and month intervals returned fixed0 0 ...crons instead of fuzzy tokens. Because of that, the scatter step never ran for these schedules.Changes
every 1 day→FUZZY:DAILYevery 1 week→FUZZY:WEEKLYevery N days→FUZZY:DAILY_INTERVAL/Nevery N weeks→FUZZY:DAILY_INTERVAL/(7N)every N months→FUZZY:MONTHLY_INTERVAL/Npkg/parser/schedule_fuzzy_scatter.go:handleDailyIntervalproducesM H */N * *, using the existing weighted daily time slot.handleMonthlyIntervalproducesM H D */N *, with a hashed day between 1 and 28.handleDailyIntervalis registered beforehandleDaily, becausehandleDailymatches theFUZZY:DAILYprefix.34 11 */2 * *.53 20 */7 * *.*/2workflows are now spread over 18 hours, with at most 8 in any hour and at most 2 in the same minute.schedule-syntax.mdand the fuzzy schedule spec are updated. Theevery N minutesrow was already wrong (it said Fixed, but the code already scatters it) and now says Fuzzy.Review notes
cron:.every Nhstill scatters only the minute, not the hour phase. Only 7 workflows here use it.pkg/workflow/compiled_lock_files_test.gonow callSetWorkflowIdentifier. They compile real workflows, and fuzzy schedules require an identifier.Validation
go test ./pkg/parser -run 'Schedule|Scatter|Cron|Interval'. It covers the new scatter tests:pkg/parser: 0 issues.