Skip to content

ci: maintainer-only manual runs; heavy-CI evaluator in shadow mode - #3862

Open
valarLip wants to merge 3 commits into
mainfrom
ci/heavy-ci-gate
Open

valarLip wants to merge 3 commits into
mainfrom
ci/heavy-ci-gate

Conversation

@valarLip

@valarLip valarLip commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Three changes to how heavy CI is allowed to run, one commit each.

1. Only maintainers can manually run workflows that reach self-hosted runners

Any user with write access can dispatch a workflow that takes GPU or build runners, on any branch (for example, the full ATOM Test accuracy matrix dispatched repeatedly on personal branches). Now a manual run first checks that the user who triggered it has the maintain or admin role on the repository, and stops before any self-hosted runner is taken otherwise, asking for a maintainer to trigger it. Runs that are not manual are unchanged.

  • The check is one canonical step (.github/scripts/authorize_dispatch_step.yaml), the first step of every root job, run only on workflow_dispatch. It adds no job, so the job graph (and the old gate's reading of it) is unchanged. atom-release and the SGLang / vLLM accuracy validations, whose first jobs take self-hosted runners, get a GitHub-hosted authorize job ahead of them.
  • tests/test_ci_dispatch_authorization.py makes coverage an invariant rather than a list: every dispatchable workflow that reaches a non-GitHub-hosted runner (directly or through a workflow it calls) must start each root job, on a GitHub-hosted runner, with exactly that step. It covers 16 workflows today and fails on any new one added without the step.
  • Not covered, on purpose: a write user can dispatch from a branch whose workflow file lacks the step.

2. Heavy-CI evaluator, shadow mode

The current gate infers from each event whether heavy CI should run, and its required check can be green on a commit heavy CI never ran on: an unapproved PR, a stacked PR later retargeted onto main (its last result stays), the window between an approval and its run. A PR that depends on another open PR also gets full heavy CI.

The CI Evaluator (ci-evaluator.yaml, code in .github/scripts/ci_gate/, see its README.md) decides from the PR's current state read from the API and writes one commit Status per suite (ATOM Test Status, ATOM SGLang Test Status, ATOM vLLM Test Status, ATOMesh Accuracy Status) on the head commit. It is success only when a run that speaks for the head proved heavy CI on it, or the change needs no suite run. Each notion is defined once:

  • a run speaks for the head when it is a PR event (pull_request, pull_request_review) of the head commit and, if the base ever changed, created after the last change (GitHub's times are to the second); a manual dispatch never does;
  • what a run proves: its latest attempt passed heavy CI, failed it, or proves nothing (running, waiting for a fork approval, cancelled, heavy CI not run); a pre-cutover run passed when its signal job and its gate job both succeeded. Any passing run is the proof; any run still going is waited for; else the latest failing run decides;
  • a PR that changes its suite's CI definition (a path the suite's run executes outside the product code): its own run's pass counts once the PR has an approved review;
  • changed paths include both sides of a rename, and a cut-short file list rules nothing out;
  • dependencies: the PR references after Depends on / Stacked on / Blocked by to the end of that paragraph (or in the next, after Depends on:), however decorated, every one checked; they hold the PR while they are open PRs here;
  • the GitHub client classifies every call: a fact (a 404 or GraphQL NOT_FOUND), transient (network, 5xx, rate limits: a 403 / 429, or a GraphQL error in a 200; retried as GitHub says), or an error.

Each PR is evaluated in its own job, in a concurrency group of that PR; triggers are pull_request_target events, suite-workflow and review-relay (ci-review-relay.yaml) completions, a manual run (an ASCII PR number), and a pass every 10 minutes over every open non-draft PR: those with no Status first, the other slots rotating through the rest, so every PR is reached with no state kept between passes (about 15 API calls a PR; ROCm's GITHUB_TOKEN allows 15,000 an hour). A failed evaluation shows as error on its PR, never over a success.

The README lists what the design assumes of GitHub, each checked against the documentation or live data (second-precision times, re-runs keeping their created_at, reviewDecision on open PRs, rate-limit signals, file and status limits, …), what a cutover needs first, and the boundaries left on purpose (runs matched to a PR by commit; ATOM vLLM Test's run installing the PR's head rather than its merge into main; the plugin and ATOMesh suites testing only their own code).

This PR only turns it on in shadow mode: the Statuses are marked [preview] and are not required; the re-runs, cancels and dependency holds a decision would take are only listed in the job summary next to the old gate's result. The old gate still decides what runs; the main ruleset is unchanged. Before any cutover, a required Status must be one nobody else can write: anyone with write access, or a workflow a PR adds, can post a Status as GitHub Actions, so the evaluator must write as a GitHub App of its own and the ruleset require that source; the repository's default workflow permissions must go to read and "Allow GitHub Actions to approve pull requests" off; and .github/CODEOWNERS must name its owners.

3. Each heavy suite runs for every change its PR run can execute

ATOM Test's gate decided relevance by a deny-list: every path not listed ran the GPU suite, so a PR changing only a CPU unit test (#3879) ran 15 GPU jobs. The plugin and ATOMesh suites had the opposite gap: their include lists missed files their PR runs execute, so a change to those ran none of them.

A change is relevant to a suite when it can alter what the suite's PR run executes. Of the product code each suite takes what it tests (ATOM Test all of atom/ but the plugins and ATOMesh; the plugin and ATOMesh suites atom/plugin/** and atom/mesh/**). Which other files a run executes cannot be proven from the repository's text (a run may compute a name), so the lists err on the side of running: every area a PR run may execute (RUN_AREAS: the packaging files and the README pyproject.toml installs with, scripts/, docker/, the CI's scripts, actions and data) counts for every suite, with the suite's own workflow; a path is left out only by a reviewed ignore entry. Other workflows, CPU unit tests, docs, tools, recipes and atomrl/ start no suite. Over the last 150 merged PRs: ATOM Test 117, SGLang 25, vLLM 24, ATOMesh 26. This changes the old gate immediately.

  • tests/test_ci_gate_suites.py: every file git tracks is classified once (product, run area, workflow, or not run, with why); what tests/ci_gate_relevance.py can derive of each run (files its PR-run steps name, from the repository root wherever it is mounted or from the naming file's directory, followed through the scripts, Dockerfiles and actions it executes) must be covered by the suite's list and never classified as not run; the workflows' gate lists equal ci_gate/suites.py.
  • The old gate (check_heavy_ci_gate.sh) now reads both sides of a rename and rules nothing out from a file list GitHub may have cut short, as the evaluator does (with an include list, a file moved out of atom/ would otherwise run nothing).
  • .github/CODEOWNERS covers the repository, owners to be filled in: main's ruleset already requires a code owner's review, which then makes an approval that authorizes heavy CI one an owner gave. Until owners are named it has no effect.

Test plan

  • tests/test_ci_gate_*.py, tests/test_ci_dispatch_authorization.py and tests/test_heavy_ci_gate.py (needs jq): 369 tests, none skipped; commit 2 alone passes its own 293.
  • tests/ci_gate_sim.py: protocol simulator over every combination of the GitHub behaviours the design does not rely on, times to the second: 64,000 random event sequences, no violation of "success only on a proved commit". Removing each of its six defences (aggregate checks its needs, merge-base check, base-change time rule, manual runs don't count, incomplete file lists rule nothing out, a self-changed CI definition needs an approved review) produces violations.
  • Platform facts checked against GitHub's documentation and live data (listed in the README), and on throwaway ci-sandbox/* branches (re-runs by GITHUB_TOKEN, re-run vs concurrency, pull_request_target using the default branch's file, the role lookup with an empty-permission token).
  • Read-only run against live PRs (CI_GATE_DRY_RUN=1): verdicts match what the runs show (e.g. [Sgl Atom][test] Check GDN forward-context step ownership #3774, changing only the SGLang plugin and its unit test, no longer needs ATOM Test, where the old gate failed it; a draft gets no Status).
  • Two independent reviews of the full diff; every confirmed finding fixed or recorded as a boundary.
  • actionlint, ruff, black.
  • After merge: the first CI Evaluator runs succeed and [preview] Statuses appear on open PRs.
  • After merge: a manual dispatch by a write-only user stops at Authorize manual run; one by a maintainer runs.

@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every eligible PR before approval:

  • ✅ Pre Checkin: Black, Ruff, catalog schema validation, non-GPU unit tests

Heavy model tests:

  • ✅ Gate checks are published on every PR so required checks do not stay missing
  • ✅ Expensive jobs run only after the PR is approved, or when a matching ci:* label is present
  • ✅ Pre Checkin must pass before approved heavy jobs continue
  • ✅ Without a matching label, expensive jobs also require a relevant path
  • ✅ A matching ci:* label is an explicit request and can open the gate even when paths would otherwise skip it

Path scope:

  • Native ATOM uses an ignore list: docs/markdown and plugin or Mesh paths are skipped
  • vLLM and SGLang use include lists: their own plugin code under atom/plugin/, plugin CI scripts, model list and release images. A core-only change does not run them; add ci:vllm / ci:sglang to ask for them
  • ATOMesh uses an include list: Mesh code, the ATOMesh accuracy workflow and its 1P1D launcher, plus the shared models_accuracy.json and accuracy_to_dashboard.py. ATOMesh benchmarks run after merge or on dispatch, not on PRs
  • Relevant path alone does not start expensive jobs; approval still opens the automatic path-scoped gate
Label Tests
ci:full Run all heavy PR model tests: native ATOM, vLLM, SGLang, and ATOMesh
ci:atom Run native ATOM model accuracy tests
ci:vllm Run ATOM vLLM OOT model accuracy tests
ci:sglang Run ATOM SGLang model accuracy tests
ci:mesh Run the ATOMesh accuracy tests, standalone and 1P1D, for Mesh-related changes

Without a matching ci:* label, heavy jobs are skipped when the path is not relevant or the PR is not approved.
Add labels via the sidebar or gh pr edit 3862 --add-label <label>

@valar-cop valar-cop left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

some changes needed..

ci green.

Comment thread .github/scripts/ci_gate/suites.py Outdated
ignore_globs=ignore,
include_globs=include,
smoke_job=smoke_job,
old_heavy_prefix="Accuracy (",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

atom-test heavy job is named exactly Accuracy, not Accuracy (, so _proves_pass never matches it. make prefix per-suite, and have tests read the name: from each workflow instead of the constant.

Comment thread .github/workflows/atom-test.yaml Outdated
jobs:
dispatch-authorization:
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: ./.github/workflows/dispatch-authorization.yaml

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

local reusable workflow resolves from the dispatched ref, so a write user can just drop the needs/if on their branch. this is an accidental-dispatch guard, not a security boundary, say so in the header. applies to all 15 callers.

Comment thread .github/workflows/atom-release.yaml Outdated
cancel-in-progress: false

jobs:
# Also gates atom-release-automation's manual runs: a called workflow sees

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

only the build job is covered, atom-release-automation's own prepare still pushes refs before auth. add the guard there too, or narrow the comment and description.

…d runners

Any user with write access could dispatch a workflow that takes GPU or
build runners, on any branch. Now a manual run of such a workflow first
checks that the user who triggered it has the maintain or admin role on
the repository, and stops before any self-hosted runner is taken
otherwise.

The check is one canonical step (.github/scripts/authorize_dispatch_step.yaml),
the first step of every root job, run only on workflow_dispatch; it adds
no job, so the job graph and the old gate's view of it are unchanged.
A root job must run on a GitHub-hosted runner, so atom-release and the
SGLang / vLLM accuracy validations, whose first jobs take self-hosted
runners, get an `authorize` job ahead of them.

tests/test_ci_dispatch_authorization.py makes this an invariant instead
of a list: every workflow that can be dispatched and reaches a runner
that is not GitHub-hosted (directly or through a workflow it calls) must
start each root job, on a GitHub-hosted runner, with exactly that step.
It found atomrl-unit-tests and atom-release-automation, which a hand
list had missed. The role lookup works with an empty-permission token
(Metadata: read), checked on a throwaway branch.

@valar-cop valar-cop left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

some changes needed..

ci green.

# result. tests/test_ci_gate_suites.py derives the required part
# from pyproject.toml and this file and checks it is covered.
CI_GATE_PATHS_INCLUDE: |
atom/**

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

atom_test.sh runs scripts/wait_infer_drain.sh, so a change to it now skips the whole GPU suite. add it here and in ci_gate/suites.py, and let the relevance test follow non-.github paths?

The heavy-CI gate today infers from each event whether heavy CI should
run, and its required check can be green on a commit heavy CI never ran
on (an unapproved PR, a stacked PR later retargeted onto main, an
approval before its run starts).

The CI Evaluator (ci-evaluator.yaml, code in .github/scripts/ci_gate)
decides from the PR's current state, read from the API, and writes one
commit Status per suite on the head commit. It is success only when a
run that speaks for the head proved heavy CI on it, or the change needs
no suite run. Each notion is defined once:

- a run speaks for the head when it is a PR event (pull_request or
  pull_request_review) of the head commit and, if the base ever changed,
  created after the last change (GitHub's times are to the second); a
  manual dispatch never does, and the commit, not the repository a run
  reports, identifies the code;
- a run's latest attempt passed heavy CI, failed it, or proves nothing
  (running, waiting for a fork approval, cancelled, heavy CI not run);
  a run of the pre-cutover workflow passed when its signal job and its
  gate job both succeeded. Any passing run is the proof; any run still
  going is waited for; else the latest failing run decides;
- a PR that changes a path its suite's run executes outside the product
  code (PRODUCT_DIRS) changes that run's definition: its own run's pass
  counts once the PR has an approved review;
- changed paths include both sides of a rename, and a cut-short file
  list rules nothing out;
- PR references (#N, owner/repo#N, the PR URL) are parsed in one place;
  dependencies are the references after "Depends on", "Stacked on" or
  "Blocked by" to the end of that paragraph (or in the next, when it
  ends at the keyword), however decorated, every one checked; they hold
  the PR while they are open PRs here;
- the GitHub client classifies every call: a fact (a 404 or GraphQL
  NOT_FOUND included), transient (network, 5xx, rate limits: a 403 / 429,
  or a GraphQL error in a 200; retried as GitHub says), or an error.

Each PR is evaluated in its own job, in a concurrency group of that PR,
from pull_request_target events, suite-workflow and review-relay
(ci-review-relay.yaml) completions, by hand (an ASCII PR number), and
every 10 minutes over every open non-draft PR, whatever its base: those
with no Status first, the other slots rotating through the rest by the
pass's time slot, so every PR is reached with no state kept. A Status
depends on what the PR list does not show, so after a lost event any
may be out of date. A failed evaluation shows as error on its PR, never
over a success.

Shadow phase: the Statuses are marked [preview] and are not required;
re-runs, cancels and dependency holds are only listed in the job summary
next to the old gate's result. The old gate still decides what runs.
The README lists what the design assumes of GitHub, each checked against
the documentation or live data, what a cutover needs first (a GitHub App
as the Status's only source), and the boundaries left on purpose.

tests/ci_gate_sim.py simulates the protocol under every combination of
the GitHub behaviours the design does not rely on; each of its six
defences is shown necessary by removing it.
ATOM Test decided relevance by a deny-list: every path not listed ran
the GPU suite, so a PR changing only a CPU unit test (#3879) ran 15 GPU
jobs. The plugin and ATOMesh suites had the opposite gap: their include
lists missed files their PR runs execute (the gate's own action and
scripts, shared download and supervision scripts, setup.py and the
README pyproject.toml installs with), so a change to those ran none.

A change is relevant to a suite when it can alter what the suite's PR
run executes. Of the product code each suite takes what it tests: ATOM
Test all of atom/ but the plugins and ATOMesh, the plugin and ATOMesh
suites atom/plugin/** and atom/mesh/**, the rest left to ATOM Test and
the runs on main. Which other files a run executes cannot be proven
from the repository's text (a run may compute a name), so the lists err
on the side of running: every area a PR run may execute (RUN_AREAS: the
packaging files and readme, scripts/, docker/, the CI's scripts,
actions and data) counts for every suite, with the suite's own workflow
and those its run reads; a suite leaves a path out only by a reviewed
ignore entry. Other workflows, CPU unit tests, docs, tools, recipes and
atomrl/ start no suite. Over the last 150 merged PRs this runs each
suite for a few more than an exact list would (ATOM Test 117 of 150).

tests/test_ci_gate_suites.py holds this together: every file git tracks
is classified once (product, run area, workflow, or not run, with why);
what tests/ci_gate_relevance.py can derive of each run (the files its
PR-run steps name, from the repository root wherever it is mounted or
from the naming file's directory, followed through the scripts,
Dockerfiles and actions it executes) must be covered by the suite's
list and never classified as not run; the four workflows' gate lists
equal ci_gate/suites.py.

The old gate (check_heavy_ci_gate.sh) now reads both sides of a rename
and rules nothing out from a file list GitHub may have cut short, as the
evaluator does: with an include list, a file moved out of atom/ would
otherwise run nothing.

.github/CODEOWNERS covers the repository, owners to be filled in: main's
ruleset already requires a code owner's review, which then makes an
approval that authorizes heavy CI one an owner gave.

@valar-cop valar-cop left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

some changes needed..

please re-run the non-GPU unit tests with logs kept, and the smoke job too..

ci Run non-GPU unit tests failed — not sure yet (medium): Log is empty (0 bytes) and no infra hint matches, so the cause cannot be read; this PR adds several new CPU tests and touches .github scripts, while the same job succeeded in the last 7 runs on main and 7 other recent runs.

log .valar/ci/job_140556095797.log is 0 bytes
same job on main: 2026-11-27T13:44 success, 13:29 success, 11:03 success, 10:25 success, 10:12 success, 09:55 success, 08:20 success
next: Re-run the job with logs retained; if pytest fails, it is almost certainly a new test in this PR (tests/test_ci_gate_*.py, tests/ci_gate_relevance.py) and must be fixed here. https://github.com/ROCm/ATOM/actions/runs/46013920213/job/140556095797

ci Offline inference smoke test failed — not sure yet (low): Log is empty (0 bytes), so neither a PR bug nor a runner/GPU fault can be excluded; the PR changes no atom/ product code, which makes a genuine inference regression unlikely, and the same job passed once recently.

log .valar/ci/job_140556285507.log is 0 bytes
same job on other recent runs: {'success': 1}
next: Re-run the smoke job and keep its log; treat as infra until the log shows otherwise. https://github.com/ROCm/ATOM/actions/runs/46013920297/job/140556285507

ci ATOM Test Gate failed — not sure yet (medium): This gate job consumes the 'Offline inference smoke test' result (optional-results: offline-smoke-test=...) and failed because that job failed; it is a cascade, not an independent failure, and the upstream log is empty.

log .valar/ci/job_140562343486.log is 0 bytes
job depends on optional-results: offline-smoke-test=...
next: No action on the gate itself; re-run it after the smoke job passes. https://github.com/ROCm/ATOM/actions/runs/46013920297/job/140562343486

This branch has not been deployed

No deployments
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.

3 participants