Skip to content

ci: list commits since last run in nightly failure alerts - #2812

Draft
kajalj22 wants to merge 10 commits into
mainfrom
gym-commits-since-last-run
Draft

kajalj22 wants to merge 10 commits into
mainfrom
gym-commits-since-last-run

Conversation

@kajalj22

Copy link
Copy Markdown
Contributor

Summary

Stacked on #2810 — rebase/retarget to main once that merges.

  • Add .github/actions/commits-since-last-run, a composite action used by both cicd-main.yml's and full-test-suite.yml's failure notifiers to list commits (short SHA + subject) since the last completed schedule/workflow_dispatch run of the same workflow, appended to the Slack alert
  • Fail-safe by design: if the previous run is still in progress, or the lookup errors for any reason, the commit list is silently skipped but the alert is always sent (continue-on-error: true, script never returns non-zero)
  • Queries the GitHub API with an explicit event= filter server-side (one call per event type) rather than fetching an unfiltered per_page=10 page and filtering client-side — cicd-main.yml still triggers on every PR push in addition to the schedule, so an unfiltered top-10 page can easily miss the actual last nightly run once there's normal PR traffic between two 4-hourly runs

Test plan

  • Confirm a forced failure posts to the Gym alerts Slack channel with the commit list when a previous nightly run exists
  • Confirm the commit list is correctly found even with intervening PR-push-triggered cicd-main.yml runs between two scheduled runs
  • Confirm a forced failure while a previous run is still in progress still sends the alert, just without a commit list

- Add a nightly cron trigger (0 9 * * *, matching NeMo-RL's schedule)
- Gate container_build and gpu_e2e_tests on the schedule event instead
  of `if: false`, so they run nightly rather than staying fully off
  (follow-up to #2801)
- Gate provider_e2e_tests (fireworks-e2e) on the schedule event too,
  since it exercises a live external provider and doesn't need to run
  on every PR push
- Nemo_CICD_Test already treats all three as non-gating; update the
  log labels to say "nightly only" instead of "temporarily disabled"

Signed-off-by: Kajal Jain <[email protected]>
- Run full-test-suite.yml (core unit tests, the full sharded server
  suite, and the wheel-install smoke test) on the same nightly cron
  as cicd-main.yml, in addition to container_build and unit_tests.
  It already alerts on failure via SLACK_TEAM_CHANNEL_WEBHOOK, so
  this reuses the same post-merge alerting path for nightly runs.
- Add a notify-nightly-failure job to cicd-main.yml that posts to the
  same Slack webhook when container_build, gpu_e2e_tests, or
  provider_e2e_tests fails on a scheduled (nightly) run.

Signed-off-by: Kajal Jain <[email protected]>
- Add workflow_dispatch to cicd-main.yml and full-test-suite.yml so
  the nightly jobs can be run on demand from the Actions UI, with a
  send_notification input to opt out of Slack alerts on manual runs
  (defaults to true for real nightly failures)
- Extend container_build/gpu_e2e_tests/provider_e2e_tests to also run
  on workflow_dispatch, matching the schedule-only gating
- Add a single Nightly_Gate job in cicd-main.yml that aggregates the
  three nightly-only job results (mirrors NeMo-RL's CI_QA_Gate
  pattern), replacing the previous multi-condition OR check
- Extract the Slack POST into a reusable composite action
  (.github/actions/notify-slack-failure) and use it from both
  cicd-main.yml's nightly notifier and full-test-suite.yml's existing
  post-merge notifier, instead of duplicating the curl/message logic

Signed-off-by: Kajal Jain <[email protected]>
Per feedback, mirror NeMo-RL's CI_QA_Gate pattern exactly: one gate
job whose pass/fail logic depends on which event triggered the run,
rather than a second Nightly_Gate job. Nemo_CICD_Test now additionally
requires container_build/gpu_e2e_tests/provider_e2e_tests to succeed
only when the run is schedule/workflow_dispatch (nightly); PR/push
runs are unaffected since those jobs are skipped in that case.
notify-nightly-failure now keys off Nemo_CICD_Test's result directly.

Signed-off-by: Kajal Jain <[email protected]>
NVIDIA-NeMo/FW-CI-templates already provides a reusable
.github/actions/send-slack-alert composite action (message + webhook
inputs) that neither Gym nor RL was using despite both hand-rolling
the same curl/jq post. Drop the Gym-local notify-slack-failure action
in favor of the shared one, pinned to the same v1.8.10 ref already
used for _cicd_preflight.yml. No local checkout needed since it's a
remote action reference.

Signed-off-by: Kajal Jain <[email protected]>
Post-merge push-to-main coverage is now redundant with the scheduled
full-test-suite run, so drop the push: [main] trigger entirely -
schedule/workflow_dispatch only. Bump both cicd-main.yml's and
full-test-suite.yml's cron from once daily (0 9 * * *) to every 4
hours (0 */4 * * *) to compensate for losing per-merge coverage.

Signed-off-by: Kajal Jain <[email protected]>
Add a pr-authors-since-last-run composite action used by both
notify-nightly-failure (cicd-main.yml) and notify-failure
(full-test-suite.yml). It finds internal (non-external) authors of
PRs merged since the last completed run of the same workflow and
appends them to the failure message.

Fail-safe behavior, per requirements:
- If the previous run is still in progress/queued, author attribution
  is skipped (no reliable "since" boundary), but the alert still goes
  out with no author line.
- External (non-member/collaborator) PR authors are excluded from
  attribution based on author_association.
- The lookup step runs with continue-on-error: true and never raises
  a non-zero exit itself, so a GitHub API hiccup can never suppress
  the alert - "Notify Gym alerts channel" always runs regardless of
  whether author lookup succeeded.

Signed-off-by: Kajal Jain <[email protected]>
Drop the org-membership/email lookup approach - it required
replicating check-nvidia-sso's private github-audits download inline
(the shared action only exposes booleans, not email) to loop over a
variable number of PR authors, which isn't verifiable without access
to that private repo. Simpler: list the commits (short SHA + subject)
since the last completed run instead, same fail-safe behavior as
before (skip silently if the previous run is still in progress or the
lookup errors; the alert is always sent regardless).

Signed-off-by: Kajal Jain <[email protected]>
The docs_only early-exit ran (and exited) before the nightly-job gate
ever executed. classify_changes computes docs_only from a diff against
HEAD~1 regardless of trigger, so a schedule/workflow_dispatch run
lands in the docs_only=true branch and exits success whenever the
latest commit on main happens to be docs-only - even though
container_build/gpu_e2e_tests/provider_e2e_tests still ran (their
`if:` only checks event_name) and could have failed. Restructure so
schedule/workflow_dispatch always evaluates unit_tests (success or
skipped) plus the three nightly jobs, independent of docs_only;
PR/push behavior is unchanged.

Verified by extracting the script and running it standalone against:
nightly+docs-only+container_build-failure -> now correctly fails
(previously passed), PR+docs-only -> still passes, nightly all-green
-> still passes.

Signed-off-by: Kajal Jain <[email protected]>
repos/.../workflows/<file>/runs?per_page=10 returns the 10 most
recent runs across ALL trigger types, then the action filtered
client-side for event == schedule/workflow_dispatch. cicd-main.yml
still triggers on every PR push, so under normal PR traffic the last
nightly run scrolls out of that unfiltered top-10 window well before
4 hours pass, silently making the commit list empty on nearly every
nightly alert for that workflow.

Query with an explicit event= filter server-side instead (one call
per event type, 5 results each), then pick whichever candidate is
more recent. Verified via a stubbed gh CLI: server-side event=schedule
query correctly finds and selects the prior nightly run even when
simulating heavy interleaved push traffic that would have pushed it
out of an unfiltered per_page=10 window.

Signed-off-by: Kajal Jain <[email protected]>
@copy-pr-bot

copy-pr-bot Bot commented Aug 26, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

kajalj22 added a commit that referenced this pull request Aug 27, 2026
…2810)

## Why
`container_build`, `gpu_e2e_tests`, `provider_e2e_tests`, and the full
test suite were queuing indefinitely on every PR push against the shared
`nemo-ci-aws-gpu-x2` runner pool (follow-up to #2801).

## Before → After

| | Before | After |
|---|---|---|
| Heavy CI trigger | Every PR push + every merge to `main` | Every 4
hours (`0 */4 * * *`) or manual `workflow_dispatch` |
| `Nemo_CICD_Test` gate | Docs-only shortcut could bypass checking the
heavy jobs entirely | Single gate, branches on `event_name`, always
checks the right jobs with proper `needs.*.result` gating |
| Slack alerts | None for these jobs | Fire on failure, but only for
`main`/release-branch runs; show all upstream results, not just the 3
nightly ones |
| Alert gating | N/A | Keyed directly on `event_name` — can't silently
disappear if an earlier job in the chain gets skipped |
| Ref-check / notify logic | N/A | Deduped into a shared
`.github/actions/is-main-or-release-ref` action; job renamed
`notify-failure` to match `full-test-suite.yml`'s convention |
| Test coverage | N/A | `tests/unit_tests/test_ci_environment.py`
extended to cover the new gating/alerting behavior (67 passing) |

Split out: the "commits since last run" alert feature is a separate
stacked PR, #2812.

## Test plan
- [ ] PR pushes skip
`container_build`/`gpu_e2e_tests`/`provider_e2e_tests`; `Nemo_CICD_Test`
still passes
- [ ] Scheduled run triggers all nightly jobs + `full-test-suite.yml` on
`main`, gated correctly
- [ ] A nightly `unit_tests` or `pre-flight` failure still sends a Slack
alert with the real cause
- [ ] Merging to `main` no longer triggers `full-test-suite.yml`
directly
- [ ] `workflow_dispatch` runs on demand; alert suppressed on
non-main/non-release refs
- [ ] `pytest tests/unit_tests/test_ci_environment.py -q` passes

---------

Signed-off-by: Kajal Jain <[email protected]>
Base automatically changed from gym-nightly-heavy-ci to main August 27, 2026 21:26
ananthsub pushed a commit that referenced this pull request Aug 27, 2026
…2810)

## Why
`container_build`, `gpu_e2e_tests`, `provider_e2e_tests`, and the full
test suite were queuing indefinitely on every PR push against the shared
`nemo-ci-aws-gpu-x2` runner pool (follow-up to #2801).

## Before → After

| | Before | After |
|---|---|---|
| Heavy CI trigger | Every PR push + every merge to `main` | Every 4
hours (`0 */4 * * *`) or manual `workflow_dispatch` |
| `Nemo_CICD_Test` gate | Docs-only shortcut could bypass checking the
heavy jobs entirely | Single gate, branches on `event_name`, always
checks the right jobs with proper `needs.*.result` gating |
| Slack alerts | None for these jobs | Fire on failure, but only for
`main`/release-branch runs; show all upstream results, not just the 3
nightly ones |
| Alert gating | N/A | Keyed directly on `event_name` — can't silently
disappear if an earlier job in the chain gets skipped |
| Ref-check / notify logic | N/A | Deduped into a shared
`.github/actions/is-main-or-release-ref` action; job renamed
`notify-failure` to match `full-test-suite.yml`'s convention |
| Test coverage | N/A | `tests/unit_tests/test_ci_environment.py`
extended to cover the new gating/alerting behavior (67 passing) |

Split out: the "commits since last run" alert feature is a separate
stacked PR, #2812.

## Test plan
- [ ] PR pushes skip
`container_build`/`gpu_e2e_tests`/`provider_e2e_tests`; `Nemo_CICD_Test`
still passes
- [ ] Scheduled run triggers all nightly jobs + `full-test-suite.yml` on
`main`, gated correctly
- [ ] A nightly `unit_tests` or `pre-flight` failure still sends a Slack
alert with the real cause
- [ ] Merging to `main` no longer triggers `full-test-suite.yml`
directly
- [ ] `workflow_dispatch` runs on demand; alert suppressed on
non-main/non-release refs
- [ ] `pytest tests/unit_tests/test_ci_environment.py -q` passes

---------

Signed-off-by: Kajal Jain <[email protected]>
@svcnvidia-nemo-ci svcnvidia-nemo-ci added area:ci CI workflows, test routing, and repository automation ci CI, automation, test queue, or workflow infrastructure work labels Oct 20, 2026

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

area:ci CI workflows, test routing, and repository automation ci CI, automation, test queue, or workflow infrastructure work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants