ci(owned-pool rescue): watch nightly-next dispatches and re-runs the build picker puts on owned Macs

Merged
TE
10d ago
+57-4

Why

Brief: nightly-next's runner picker "routes only attempt-1 push runs to owned (glaeda) labels. workflow_dispatch runs and attempt-2+ re-runs never get the routing token ... so a dispatched or re-run tip nightly can never build on an owned mini. They must go through the same picker: Linux or owned Macs first, Blacksmith last."

The picker change is on feat-cmux-next (the companion PR). That change only holds if the owned-pool rescue, which runs from main, watches the runs it puts on owned Macs. Otherwise a refused or stuck job on an owned label would never be moved. This PR has to land first.

What

  • nightly_target() now accepts a nightly-next workflow_dispatch run as well as a push (NIGHTLY_NEXT_EVENTS). Main's nightly keeps its old scope: attempt 1 of a push or schedule.
  • owned_rerun() returns true for nightly.yml on nightly-next at any attempt. That lets sweep_target() resume a marked nightly-next run on attempt 3 or later, for example after a person's full re-run.
  • The sweeper finds these runs through the owned-pool-watch marker that the picker job now uploads. Nothing changes in ci-owned-pool-rescue.yml: its workflow_run path still covers only attempt 1.
  • A refusal on a dispatch run gets its failed jobs re-run, never a cancel. That re-run keeps the earlier attempt's pick, so it takes Blacksmith, and the loop ends there.

Tests

tests/test_ci_owned_pool_rescue.py: 254 tests passed in a cmux-ci test Linux run. New tests:

  • a nightly-next dispatch is a target;
  • the sweeper adopts dispatch attempts 1 and 2 and push attempts 2 and 3;
  • main's scope does not change;
  • a refused dispatch re-runs its failed jobs on Blacksmith with no cancel.

Risk: low. The change is limited to which nightly-next runs the rescue watches. No cancel paths change, and there are no workflow permission, secret or trigger changes.

Agent session: agent session

šŸ¤– Generated with Claude Code


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

Summary by CodeRabbit

  • CI Updates
    • Nightly runs on nightly-next can now be started by dispatch as well as by pushes.
    • Re-runs on nightly-next are recognized as owned runs, and re-runs of failed jobs retain their earlier placement.
    • Main nightly runs remain limited to the first attempt of a push or scheduled run.
    • Pull requests and fork dispatches remain unsupported nightly targets; refused nightly-next dispatch re-runs route failed jobs toward Blacksmith.