ci(nightly-next): main mirror of the canary mode resolver (#22599)

Merged
TE
17d ago
+206-12

This is the main half of #22599, which merged into feat-cmux-next. It follows the same pattern as #21900.

Problem: nightly-next-canary.yml runs on a schedule, and schedules run only from main. Until this lands, the post-publication canary still reads vars.NIGHTLY_NEXT_CANARY directly, so while the variable is unset it stays in report mode. The pre-publication canary (nightly.yml on nightly-next) does use the new resolver, so the two canaries can disagree after the one-week flip.

Change: two files, byte-identical to feat-cmux-next:

  • scripts/ci/nightly_next_canary_mode.py: values report / enforce / off are used as given. Unset or auto reports until NIGHTLY_NEXT_CANARY_ENFORCE_AFTER (default 2026-10-27 16:00 UTC), then enforces if the canary failed no build in the week before. Any other value fails the run.
  • nightly-next-canary.yml: pick resolves the mode (sparse checkout of the script, issues: read); the pull and the issue text use it.

Behavior is unchanged until 2026-10-27 16:00 UTC unless someone sets the variable. Setting NIGHTLY_NEXT_CANARY=report keeps report mode for good.

Verification: the resolver's tests (tests/test_nightly_next_canary_mode.py) live on feat-cmux-next and passed in #22599's CI. They are not mirrored here because they also check feat-cmux-next's nightly.yml. This PR's own pull_request canary run exercises the workflow.

🤖 Generated with Claude Code

Agent session: cosmic-gray


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Mirrors the canary mode resolver from feat-cmux-next to main so the post-publication canary agrees with the pre-publication one. The scheduled nightly-next-canary.yml runs from main, so until this lands it still reads NIGHTLY_NEXT_CANARY directly while nightly.yml on nightly-next uses the new resolver — the two canaries can disagree after the auto-flip.

  • Adds scripts/ci/nightly_next_canary_mode.py: report, enforce, and off are used as given; unset or auto reports until NIGHTLY_NEXT_CANARY_ENFORCE_AFTER (default 2026-10-27 16:00 UTC) then enforces, unless the canary failed a build in the week before that; unknown values fail the run.
  • Updates nightly-next-canary.yml to resolve the mode via the script and use it for the pull and issue text.

Behavior is unchanged until 2026-10-27 16:00 UTC unless the variable is set — NIGHTLY_NEXT_CANARY=report keeps report mode permanently.

Summary by CodeRabbit

  • New Features

    • Nightly-next canary runs now support automatic progression from reporting to enforcement after the configured period.
    • Explicit canary modes—report, enforce, or off—continue to be supported.
    • Enforcement considers recent failure reports before activating and provides the resolved mode in failure notifications.
  • Bug Fixes

    • Failures encountered while checking recent canary results now keep the workflow in reporting mode instead of enforcing unexpectedly.
    • Invalid canary settings and timestamps are detected and reported clearly.