Skip to content

Add a scheduled seed-set rotation job - #154

Merged
arekay-nv merged 4 commits into
mainfrom
feat/seed-rotation-job
Nov 3, 2026
Merged

arekay-nv merged 4 commits into
mainfrom
feat/seed-rotation-job

Conversation

@arav-agarwal2

Copy link
Copy Markdown
Contributor

§4.6 publishes a new seed set every two cohorts, each adoptable for four, so two are
normally adoptable at once. In practice seedset.yaml has never been rotated — it
carries a single set A under one file-level cohort-id, and rotation is entirely
manual. Right now only one set is adoptable where §4.6 expects two.

This adds tools/rotate_seed_sets.py and .github/workflows/rotate-seed-sets.yml.
The job runs every Wednesday and publishes one week before the cohort a set
becomes adoptable in, so the working group gets a review window instead of being
asked to merge a rules artifact on the morning it takes effect. The rules set no lead
time (§4.6 is silent), so the week is an operational convention, not a rule.

Nothing is ever pushed to main: a due rotation opens a draft PR.

Why each set carries its own cohorts: window

The checker applies the file-level cohort-id to every set that lacks an explicit
window. Appending a new set under a bumped cohort-id would therefore silently re-key
set A too, extending its adoption window and letting new submissions bind to a
retired set. The loader already supports a per-set override, so the job writes one for
every set and backfills A on the first run.

Equally load-bearing: sets are only ever appended, never removed. A submission
stays bound to its set for the full Pareto-update window, and seed-set-membership
fails any submission whose set is missing from this file. The file grows; that is
correct.

Verified against the real checker

The rotated file was loaded through submission_checker.seed_sets.load_seed_sets, not
just the generator's own view:

A: ('2026-10-C1', '2026-11-C0', '2026-11-C1', '2026-12-C0')
B: ('2026-11-C1', '2026-12-C0', '2026-12-C1', '2027-01-C0')

adoptable in 2026-11-C1: ['A', 'B']   <- §4.6's "two normally available"
adoptable in 2026-12-C1: ['B']        <- A dropped once N+4 opened

The schedule is asserted in CI across a year of Wednesdays (12 publications, each
exactly 7 days early). Publishing is idempotent: once a set lands, the run on the
cohort date itself reports elapsed 0 -> not due, and if the PR is still open when the
cohort opens the job comments on it rather than publishing a duplicate.

Manual control

workflow_dispatch takes cohort (publish a specific cycle, e.g. 2026-11-C0),
force (publish off-cadence), ready (open ready-for-review instead of draft) and
dry_run.

Two things for the working group

§4.6 reads two ways. On main a set is keyed by the cohort it is published in;
on feat/change-cohort-selection it is keyed to the first cohort that may adopt it.
Publishing ahead of time is only coherent under the second reading — which is also what
the checker implements (seed_sets.py derives the window as that cohort plus the next
three). Only main's prose lags. Worth settling, but no behaviour here depends on it.

The checker's copy is separate. It reads its own bundled
src/submission_checker/data/seed_sets.yaml, so a merged set is not usable until that
copy is updated. Automating the mirror is deliberately left for separate work; each
generated PR carries the reminder.

🤖 Generated with Claude Code

Submission Rules §4.6 publishes a new seed set every two cohorts, each
adoptable for four, so two are normally adoptable at once. In practice
seedset.yaml has never been rotated: it carries one set and one file-level
cohort-id, and rotation is entirely manual.

tools/rotate_seed_sets.py appends a set with fresh uint64 seeds and an
explicit adoption window, and .github/workflows/rotate-seed-sets.yml runs it
every Wednesday, publishing one week before the cohort a set becomes
adoptable in so there is time to review it. The rules set no lead time —
§4.6 is silent — so the week is an operational convention.

Three things the registry's shape forces:

- Every set gets its own `cohorts:` list. The checker applies the file-level
  cohort-id to any set lacking one, so appending under a bumped cohort-id
  would silently re-key older sets and keep retired ones adoptable.
- Sets are only ever appended, never removed. A submission stays bound to
  its set for the full Pareto-update window, and seed-set-membership fails a
  submission whose set is absent from the file.
- The audit validates the uint64 range and parses each cohort id. The
  checker str()-casts window entries without validating them, so a typo
  silently never matches.

Nothing is pushed to main: a due rotation opens a draft PR.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@arav-agarwal2
arav-agarwal2 requested a review from a team October 23, 2026 15:44
@github-actions

Copy link
Copy Markdown

MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅

@arekay-nv arekay-nv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Local review found one blocking workflow issue, reproduced with the actual Rotate step under bash -e. The year-long publication calendar check, post-rotation registry audit, seed preservation, and opening-day idempotence checks passed.

Comment thread .github/workflows/rotate-seed-sets.yml Resolved

@arekay-nv arekay-nv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @arav-agarwal2 !

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A successful rotation returns 1, triggering Bash errexit before status capture and causing every due rotation to fail before a PR can be opened.

4 open issues
What changed in this PR

Adds automated seed-set rotation for the §4.6 cadence, proposing new registry entries through draft PRs one week before adoption begins.

Changes:

  • Adds registry auditing, seed generation, and explicit per-set adoption windows while retaining historical sets.
  • Adds a weekly workflow with manual overrides, schedule checks, duplicate-PR detection, and overdue reminders.
  • Includes generated PR guidance for review and the separate checker-data update.
File Description
tools/​rotate_seed_sets.py Implements cohort scheduling, registry validation, and append-only seed-set generation.
.github/​workflows/​rotate-seed-sets.yml Schedules rotation and manages draft PR publication and reminders.

Review effort: Balanced

Comment thread .github/workflows/rotate-seed-sets.yml Resolved
Comment thread .github/workflows/rotate-seed-sets.yml Resolved
Comment thread .github/workflows/rotate-seed-sets.yml Resolved
Comment thread tools/rotate_seed_sets.py Resolved
- Rotate: capture the exit status with `|| RC=$?` so bash -e does not end
  the step when a set is published (exit 1).
- Any open seed-rotation PR now blocks a new rotation, not only one for the
  current target cohort; the overdue nudge goes to that pending PR.
- Push the rotation branch with --force-with-lease so a branch left by a
  failed run or an unmerged closed PR does not block the retry.
- Backfill `cohorts: null` as well as a missing window.
- Exit 2 on an unexpected error: Python's default exit 1 read as
  "published" to the workflow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The PR lookup suppresses failures that can allow existing rotation branches to be overwritten and accepts fork PRs that can block subsequent rotation runs.

2 open issues
4 resolved since last review

Review effort: Balanced

Comment on lines +125 to +129
read -r number cohort < <(gh pr list --repo "$GITHUB_REPOSITORY" --state open \
--limit 100 --json number,headRefName --jq '
[.[] | select(.headRefName | test("^seed-rotation/[0-9]{4}-[0-9]{2}-C[01]$"))]
| sort_by(.number) | .[0] // empty
| "\(.number) \(.headRefName | ltrimstr("seed-rotation/"))"') || true

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed at eec4c23: [P2] Abort the run when the pending-PR lookup fails.

Reproduced locally under bash -euo pipefail: when the producer in read -r number cohort < <(gh pr list ...) || true exits nonzero, the step still succeeds with both variables empty. A transient GitHub API failure therefore passes the existing.number == '' guard and generates fresh seeds.

If the target cohort already has a pending rotation PR, the later git ls-remote obtains that branch's current SHA and git push --force-with-lease succeeds against it, replacing the seeds already under review. The lease does not prevent this because it uses the freshly fetched SHA.

Please capture gh pr list output in a separate checked command substitution before parsing it. A successful empty response should mean no pending PR; a failed query should stop the job before generation or push.

Comment thread .github/workflows/rotate-seed-sets.yml Resolved
Comment thread tools/rotate_seed_sets.py

def next_set_id(existing: set[str]) -> str:
"""The next unused single-letter set id."""
for code in range(ord("A"), ord("Z") + 1):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this long term enough?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be enough for two years, i guess in between that itself new version would be released? so i guess thats fine?

Also maybe we need to revisit how id in a seed-set is populated. Maybe we could replace having A,B,C,... with latest-cohort-id:A? @arekay-nv

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think rotating between A,B,C should be fine and we can discuss that async since that would not be an issue until we generate a new set after C - in the meanwhile, we can merge this PR and generate a PR for B today and then fixup the workflow.

Fix JSON query syntax for PR listing in workflow.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@arekay-nv
arekay-nv merged commit fcfb1e3 into main Nov 3, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants