Repository navigation
Optimize fuzzy scheduler to avoid hour-boundary peaks - #22480
Conversation
All scattered schedules now produce minutes in [5, 54], avoiding the 5-minute windows before and after each hour (including 00:00 UTC) that are subject to GitHub Actions usage peaks. Changes: - Add avoidHourBoundary() helper (remaps [0-4]→[5-9], [55-59]→[50-54]) - FUZZY:DAILY / FUZZY:DAILY_WEEKDAYS: use 24×50 slot hash - FUZZY:HOURLY/N / FUZZY:HOURLY_WEEKDAYS/N: use 50-slot hash offset +5 - FUZZY:WEEKLY, FUZZY:WEEKLY:DOW: use 24×50 slot hash - FUZZY:BI_WEEKLY, FUZZY:TRI_WEEKLY: use N×24×50 slot hash - FUZZY:*_AROUND / FUZZY:*_BETWEEN: apply avoidHourBoundary post-scatter - Update stability test expected values and wasm golden file - Add TestScatterScheduleAvoidsHourBoundary covering all 21 patterns Co-authored-by: pelikhan <[email protected]> Agent-Logs-Url: https://github.com/github/gh-aw/sessions/152c5f46-ece5-4427-9ca3-d3b23ea0f14b
|
@copilot show distribution of current workflows, check uniformity |
All 85 fuzzy-scattered workflow schedules recompiled. Every scattered minute is now in [5, 54], avoiding peak windows at hour boundaries." Co-authored-by: pelikhan <[email protected]> Agent-Logs-Url: https://github.com/github/gh-aw/sessions/6f071ffe-87f4-4a7b-9d77-83c6d1b5c02b
Here's the distribution across the 70 fuzzy-scheduled workflows in this repo after recompile (commit The distribution is reasonably uniform across [5, 54] — chi-square = 43.8, well below the critical value of 66.3 (p=0.05, 49 df). The slight skew toward [20-39] is expected with FNV-1a over a small population. The 34 workflows showing Also committed the 85 recompiled lock files that were missing from the previous commit. |
There was a problem hiding this comment.
Pull request overview
This PR updates the fuzzy schedule scattering algorithm to avoid GitHub Actions contention windows near the top/bottom of each hour by ensuring all scattered cron minutes land in [5, 54].
Changes:
- Add an hour-boundary avoidance step for target-anchored fuzzy patterns (e.g.,
*_AROUND,*_BETWEEN). - Change uniform-scatter patterns to hash into 50 valid minute slots per hour (minutes 5–54) instead of all 60.
- Update stability expectations and golden/lockfile outputs to match the new deterministic scatter results.
Reviewed changes
Copilot reviewed 89 out of 89 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/parser/schedule_fuzzy_scatter.go | Implements hour-boundary avoidance and updates slot mapping for uniform scatter patterns. |
| pkg/parser/schedule_fuzzy_scatter_test.go | Adds an invariant test asserting scattered minutes are always in [5,54]. |
| pkg/parser/schedule_parser_stability_test.go | Updates expected scattered cron outputs for cross-platform consistency tests. |
| pkg/workflow/testdata/wasm_golden/TestWasmGolden_CompileFixtures/smoke-copilot.golden | Updates wasm golden output to reflect new scattered cron minute. |
| .github/workflows/workflow-skill-extractor.lock.yml | Updates scattered cron minute/day to match new algorithm output. |
| .github/workflows/workflow-normalizer.lock.yml | Updates scattered cron minute to match new algorithm output. |
| .github/workflows/workflow-health-manager.lock.yml | Updates scattered cron minute to match new algorithm output. |
| .github/workflows/weekly-safe-outputs-spec-review.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/weekly-editors-health-check.lock.yml | Updates scattered cron minute/day to match new algorithm output. |
| .github/workflows/weekly-blog-post-writer.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/update-astro.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/unbloat-docs.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/ubuntu-image-analyzer.lock.yml | Updates scattered cron minute/day to match new algorithm output. |
| .github/workflows/terminal-stylist.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/sub-issue-closer.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/step-name-alignment.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/static-analysis-report.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/smoke-update-cross-repo-pr.lock.yml | Updates scattered cron minute to match new algorithm output. |
| .github/workflows/smoke-test-tools.lock.yml | Updates scattered cron minute to match new algorithm output. |
| .github/workflows/smoke-multi-pr.lock.yml | Updates scattered cron minute to match new algorithm output. |
| .github/workflows/smoke-gemini.lock.yml | Updates scattered cron minute to match new algorithm output. |
| .github/workflows/smoke-create-cross-repo-pr.lock.yml | Updates scattered cron minute to match new algorithm output. |
| .github/workflows/smoke-copilot.lock.yml | Updates scattered cron minute to match new algorithm output. |
| .github/workflows/smoke-codex.lock.yml | Updates scattered cron minute to match new algorithm output. |
| .github/workflows/smoke-claude.lock.yml | Updates scattered cron minute to match new algorithm output. |
| .github/workflows/sergo.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/semantic-function-refactor.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/schema-consistency-checker.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/safe-output-health.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/repo-tree-map.lock.yml | Updates scattered cron minute to match new algorithm output. |
| .github/workflows/prompt-clustering-analysis.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/metrics-collector.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/lockfile-stats.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/jsweep.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/issue-arborist.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/instructions-janitor.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/gpclean.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/go-logger.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/github-remote-mcp-auth-test.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/firewall-escape.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/duplicate-code-detector.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/draft-pr-cleanup.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/docs-noob-tester.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/discussion-task-miner.lock.yml | Updates scattered cron minute to match new algorithm output. |
| .github/workflows/developer-docs-consolidator.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/dependabot-burner.lock.yml | Updates scattered cron minute/day to match new algorithm output. |
| .github/workflows/delight.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/dead-code-remover.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/daily-workflow-updater.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/daily-testify-uber-super-expert.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/daily-team-evolution-insights.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/daily-syntax-error-quality.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/daily-semgrep-scan.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/daily-security-red-team.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/daily-secrets-analysis.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/daily-safe-outputs-conformance.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/daily-safe-output-optimizer.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/daily-safe-output-integrator.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/daily-rendering-scripts-verifier.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/daily-regulatory.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/daily-performance-summary.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/daily-observability-report.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/daily-multi-device-docs-tester.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/daily-malicious-code-scan.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/daily-issues-report.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/daily-integrity-analysis.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/daily-function-namer.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/daily-firewall-report.lock.yml | Updates scattered cron minute to match new algorithm output. |
| .github/workflows/daily-doc-updater.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/daily-doc-healer.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/daily-compiler-quality.lock.yml | Updates scattered cron minute to avoid 00:00 boundary. |
| .github/workflows/daily-community-attribution.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/daily-code-metrics.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/daily-cli-tools-tester.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/daily-cli-performance.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/daily-assign-issue-to-user.lock.yml | Updates scattered cron minute to avoid hour boundary. |
| .github/workflows/copilot-session-insights.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/copilot-pr-prompt-analysis.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/copilot-cli-deep-research.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/copilot-agent-analysis.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/contribution-check.lock.yml | Updates scattered cron minute to match new algorithm output. |
| .github/workflows/constraint-solving-potd.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/code-simplifier.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/cli-version-checker.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/claude-code-user-docs-review.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/auto-triage-issues.lock.yml | Updates scattered cron minute to match new algorithm output. |
| .github/workflows/audit-workflows.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/agent-persona-explorer.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
| .github/workflows/agent-performance-analyzer.lock.yml | Updates scattered cron minute/hour to match new algorithm output. |
Comments suppressed due to low confidence (1)
pkg/parser/schedule_fuzzy_scatter.go:301
- Applying
avoidHourBoundary(scatteredMinutes % 60)can move the scattered time outside the requested DAILY_BETWEEN time window for narrow ranges (e.g., a range ending at HH:02 could produce HH:00 which then shifts to HH:05). Since this pattern is documented/used as "scatter within the time range", the post-processing should preserve the invariant that the final (hour, minute) lies within the specified range (including midnight-wrapping ranges).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // avoidHourBoundary remaps a minute value to avoid the 5-minute window before | ||
| // and after each hour (minutes 0–4 and 55–59). These windows are subject to | ||
| // usage peaks on GitHub Actions, especially at 00:00 UTC. | ||
| // Minutes [0, 4] are shifted to [5, 9] and minutes [55, 59] are shifted to [50, 54], | ||
| // keeping all results within [5, 54]. | ||
| // | ||
| // The input is expected to be in the range [0, 59] (a valid minute value). | ||
| // Values outside this range are not remapped. | ||
| func avoidHourBoundary(minute int) int { | ||
| if minute < 5 { | ||
| return minute + 5 | ||
| } | ||
| if minute > 54 { | ||
| return minute - 5 | ||
| } |
There was a problem hiding this comment.
avoidHourBoundary is documented as leaving values outside [0,59] unchanged, but the implementation remaps any minute < 5 (including negatives) and any minute > 54 (including values > 59). Either tighten the conditionals to only remap within [0,59] or update the doc comment to match the actual behavior/assumptions (e.g., that callers pass a valid minute).
| hour := scatteredMinutes / 60 | ||
| minute := scatteredMinutes % 60 | ||
| minute := avoidHourBoundary(scatteredMinutes % 60) |
There was a problem hiding this comment.
Applying avoidHourBoundary(scatteredMinutes % 60) can move the scattered time outside the requested DAILY_BETWEEN_WEEKDAYS time window for narrow ranges (same issue as the non-weekdays variant). For correctness, the boundary-avoidance adjustment should not violate the "between START and END" constraint; consider scattering over the set of valid minutes in the range (excluding [0–4] and [55–59]) or clamping/adjusting in a way that stays within the range.
This issue also appears on line 300 of the same file.
| // Parse the raw minute number. | ||
| minuteStr := fields[0] | ||
| var minute int | ||
| if _, scanErr := fmt.Sscanf(minuteStr, "%d", &minute); scanErr != nil { | ||
| t.Fatalf("could not parse minute from cron %q: %v", result, scanErr) |
There was a problem hiding this comment.
The minute parsing uses fmt.Sscanf(minuteStr, "%d", &minute), which will accept tokens like "5-10" as 5 (trailing non-digits are ignored). To ensure this test really enforces that the cron minute field is a single integer, parse with strconv.Atoi (and fail if it errors) or otherwise validate that minuteStr matches ^[0-9]+$ before converting.
GitHub Actions sees usage spikes at 00:00 UTC and within ±5 minutes of every hour. The fuzzy scatter algorithm previously had no such awareness, so scattered schedules could land in these high-contention windows.
Changes
Uniform-distribution patterns (
FUZZY:DAILY,FUZZY:DAILY_WEEKDAYS,FUZZY:HOURLY/N,FUZZY:HOURLY_WEEKDAYS/N,FUZZY:WEEKLY,FUZZY:WEEKLY:DOW,FUZZY:BI_WEEKLY,FUZZY:TRI_WEEKLY)N×60slots toN×50slots; minute computed as(hash % 50) + 5Target-anchored patterns (
FUZZY:DAILY_AROUND,FUZZY:DAILY_BETWEEN,FUZZY:WEEKLY_AROUND, and their_WEEKDAYSvariants)avoidHourBoundary(minute)post-processes the scattered minute:[0–4] → [5–9],[55–59] → [50–54]All patterns now guarantee the minute field is in [5, 54], which covers 00:00 UTC automatically.
Invariant enforced by new test
Stability test expected values and the
smoke-copilotwasm golden file are updated to reflect the new deterministic outputs.