Repository navigation
fix(ci): reduce control-job queueing and release superseded runs - #28717
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep review at f912c6b against main b349fea: no concrete blocking finding. COMMENT only for this self-authored PR; CI readiness was explicitly bypassed, not treated as validation.
Change map reviewed: (1) preflight consolidation and every downstream scope/BVT/coverage/3.0 consumer, (2) strict required-result verification and tests, (3) independent supersession cancellation workflow/helper and state-transition tests, (4) trusted runner configuration and documented rollout. The implementation matches the documented narrow recovery policy; it does not claim to solve missing runner capacity or prove teardown from API acceptance.
Preflight preserves the scope routes, complementary BVT groups and common run/attempt generation. Failed/cancelled/incomplete preflight, missing producers and invalid BVT plans remain fail-closed in CI Required. The summary retains always(); this controller neither creates successful checks nor relaxes branch protection. Trusted helper checkout is pinned to github.workflow_sha; the write-capable controller consumes validated API metadata, not PR scripts/artifacts. The default-branch manual guard and numeric input validation prevent arbitrary helper revision/input execution.
Cancellation analysis: same workflow/event, head repository ID and branch, lower run ID, and start-time fences constrain targets; fresh target/successor attempt and status reads precede mutation and escalation. Delayed completion, reruns and 409 races are revalidated, while 403/transport/force errors remain visible. The two-minute grace is shared rather than multiplied by target count. The non-atomic read/cancel window is an explicitly acknowledged platform limitation, not claimed away by these checks.
| Unhappy-path dimension | Closure |
|---|---|
| Ownership/cleanup | No new background worker or shared mutable state; per-invocation maps and sequential awaited requests. Normal cancellation precedes force so old-run diagnostics get grace. |
| Wait termination | Twelve shared polls and a six-minute job execution limit; zero candidates means no polling. Queue delay and platform runner teardown remain outside these bounds. |
| Growth/work | Discovery fails visibly above 100 rows per status; candidate maps and polling rounds are bounded. No unbounded retries or per-candidate two-minute sleeps. |
Evidence: inspected all changed hunks and tests, prior comments (no prior decisive review), and live metadata for cited successor 34578155424, which confirms the API head-repository/branch identity used here. Reviewed GitHub's documented workflow_run and workflow-run API semantics (events, API). Reused the PR's reported 26 passing Node contract tests and actionlint result; I did not independently rerun them or cancel any live workflow. Post-merge scheduler recovery and any isolated control pool still require operational acceptance. A configured unavailable label has no automatic fallback, and conservative ordering/start-time fences mean manual dispatch is not a general force-cancel escape hatch. These are recorded rollout limits, not evidence of a new correctness blocker.
…rixorigin#28717) ## What type of PR is this? - [ ] API-change - [x] BUG - [x] Improvement - [x] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related to matrixorigin#28419 (required-check handling of cancelled CI producers). ## What this PR does / why we need it: Reduce lightweight CI queueing by combining PR validation, change classification and complementary BVT planning into one `CI preflight` job. Full/BVT preparation uses one runner allocation instead of three; UT/docs preparation uses one instead of two. Preserve all scope routes, coverage generation wiring and 3.0-dev validation behavior. The strict verifier rejects failed, cancelled or incomplete preflight results and invalid BVT group plans. Preflight, `CI Required` and the independent cancellation controller use optional `CI_CONTROL_RUNNER_LABEL`, falling back to `ubuntu-latest` when unset. This supports a trusted isolated Linux control pool without borrowing UT/BVT capacity. No pool has been provisioned or repository variable changed; operators must verify the pool before configuring its label. A configured but unavailable pool does not automatically fall back. This addresses allocation overhead and enables capacity isolation; it does not claim to resolve GitHub-hosted capacity exhaustion by code alone. [Run 34571127635](https://github.com/matrixorigin/matrixone/actions/runs/34571127635), with failed producers and a queued summary, illustrates the separate capacity case. An older MatrixOne ALL CI run can keep its branch concurrency group after cancellation because `CI Required` uses `always()` and is queued for a runner. In [run 34575985362](https://github.com/matrixorigin/matrixone/actions/runs/34575985362), UT, SCA, coverage and BVT were cancelled, but the summary stayed queued; [successor 34578155424](https://github.com/matrixorigin/matrixone/actions/runs/34578155424) remained pending with zero jobs. Add an independent `workflow_run: requested` controller outside the blocked concurrency group. It requests normal cancellation for older matching runs, allows a shared two-minute cleanup grace, then force-cancels survivors through GitHub's API. Match workflow/event, head repository ID, branch, run ordering and attempt/start-time fences; recheck targets before mutation. Handle normal-cancellation 409 conflicts through fresh state inspection and retain visible failures for permission/transport errors. No older matching runs means no polling wait. Keep the strict `CI Required` verifier and its `always()` condition: making the only protected check skip on cancellation could allow incomplete CI to count as successful. Bound summary execution to five minutes. The controller reads only its trusted workflow revision, never PR code or artifacts, and does not write check conclusions. Its `actions: write` permission is isolated to the new workflow. The default-branch-only manual dispatch accepts a successor run ID for recovery after reruns, since GitHub does not emit `workflow_run: requested` for reruns. Document cancellation semantics and rollout limits, and include the new contracts in the existing secret-free CI scope test workflow. ### Validation - `node --test .github/ci/*.test.cjs`: 26 tests passed, including normal teardown, stuck summary escalation, strict required-check rejection, BVT plan validation, modern/3.0 preflight routing, configurable runner fallback, cross-fork/branch/workflow exclusions, delayed events, rerun fences, completion races, 409/403/500 responses and bounded discovery. - `go run github.com/rhysd/actionlint/cmd/[email protected] .github/workflows/ci-cancellation.yml .github/workflows/entrypoint.yaml .github/workflows/ci-scope-check.yml`: passed. - `git diff --check`: passed. - Independent GPT-6 medium final review: no blocking findings; reviewer also ran all 26 tests. ### Rollout and limitations The controller must land on the default branch before the workflow_run trigger is active. Post-merge acceptance must confirm a pending successor triggers recovery, an older stuck run reaches a terminal state, and the successor starts. Local tests mock API state transitions; they do not prove GitHub scheduler behavior. No live workflow was cancelled during validation. Both the controller and summary still need a hosted runner; execution timeouts do not bound queue delay. Force cancellation after the grace may interrupt remaining old-run diagnostics, and API acceptance is not proof of runner teardown. Cancellation and state reads are not atomic. A manually cancelled run with no successor is outside automatic recovery scope. Test suites, coverage requirements and branch protection are unchanged.
…rixorigin#28717) ## What type of PR is this? - [ ] API-change - [x] BUG - [x] Improvement - [x] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related to matrixorigin#28419 (required-check handling of cancelled CI producers). ## What this PR does / why we need it: Reduce lightweight CI queueing by combining PR validation, change classification and complementary BVT planning into one `CI preflight` job. Full/BVT preparation uses one runner allocation instead of three; UT/docs preparation uses one instead of two. Preserve all scope routes, coverage generation wiring and 3.0-dev validation behavior. The strict verifier rejects failed, cancelled or incomplete preflight results and invalid BVT group plans. Preflight, `CI Required` and the independent cancellation controller use optional `CI_CONTROL_RUNNER_LABEL`, falling back to `ubuntu-latest` when unset. This supports a trusted isolated Linux control pool without borrowing UT/BVT capacity. No pool has been provisioned or repository variable changed; operators must verify the pool before configuring its label. A configured but unavailable pool does not automatically fall back. This addresses allocation overhead and enables capacity isolation; it does not claim to resolve GitHub-hosted capacity exhaustion by code alone. [Run 34571127635](https://github.com/matrixorigin/matrixone/actions/runs/34571127635), with failed producers and a queued summary, illustrates the separate capacity case. An older MatrixOne ALL CI run can keep its branch concurrency group after cancellation because `CI Required` uses `always()` and is queued for a runner. In [run 34575985362](https://github.com/matrixorigin/matrixone/actions/runs/34575985362), UT, SCA, coverage and BVT were cancelled, but the summary stayed queued; [successor 34578155424](https://github.com/matrixorigin/matrixone/actions/runs/34578155424) remained pending with zero jobs. Add an independent `workflow_run: requested` controller outside the blocked concurrency group. It requests normal cancellation for older matching runs, allows a shared two-minute cleanup grace, then force-cancels survivors through GitHub's API. Match workflow/event, head repository ID, branch, run ordering and attempt/start-time fences; recheck targets before mutation. Handle normal-cancellation 409 conflicts through fresh state inspection and retain visible failures for permission/transport errors. No older matching runs means no polling wait. Keep the strict `CI Required` verifier and its `always()` condition: making the only protected check skip on cancellation could allow incomplete CI to count as successful. Bound summary execution to five minutes. The controller reads only its trusted workflow revision, never PR code or artifacts, and does not write check conclusions. Its `actions: write` permission is isolated to the new workflow. The default-branch-only manual dispatch accepts a successor run ID for recovery after reruns, since GitHub does not emit `workflow_run: requested` for reruns. Document cancellation semantics and rollout limits, and include the new contracts in the existing secret-free CI scope test workflow. ### Validation - `node --test .github/ci/*.test.cjs`: 26 tests passed, including normal teardown, stuck summary escalation, strict required-check rejection, BVT plan validation, modern/3.0 preflight routing, configurable runner fallback, cross-fork/branch/workflow exclusions, delayed events, rerun fences, completion races, 409/403/500 responses and bounded discovery. - `go run github.com/rhysd/actionlint/cmd/[email protected] .github/workflows/ci-cancellation.yml .github/workflows/entrypoint.yaml .github/workflows/ci-scope-check.yml`: passed. - `git diff --check`: passed. - Independent GPT-6 medium final review: no blocking findings; reviewer also ran all 26 tests. ### Rollout and limitations The controller must land on the default branch before the workflow_run trigger is active. Post-merge acceptance must confirm a pending successor triggers recovery, an older stuck run reaches a terminal state, and the successor starts. Local tests mock API state transitions; they do not prove GitHub scheduler behavior. No live workflow was cancelled during validation. Both the controller and summary still need a hosted runner; execution timeouts do not bound queue delay. Force cancellation after the grace may interrupt remaining old-run diagnostics, and API acceptance is not proof of runner teardown. Cancellation and state reads are not atomic. A manually cancelled run with no successor is outside automatic recovery scope. Test suites, coverage requirements and branch protection are unchanged.
…rixorigin#28717) ## What type of PR is this? - [ ] API-change - [x] BUG - [x] Improvement - [x] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related to matrixorigin#28419 (required-check handling of cancelled CI producers). ## What this PR does / why we need it: Reduce lightweight CI queueing by combining PR validation, change classification and complementary BVT planning into one `CI preflight` job. Full/BVT preparation uses one runner allocation instead of three; UT/docs preparation uses one instead of two. Preserve all scope routes, coverage generation wiring and 3.0-dev validation behavior. The strict verifier rejects failed, cancelled or incomplete preflight results and invalid BVT group plans. Preflight, `CI Required` and the independent cancellation controller use optional `CI_CONTROL_RUNNER_LABEL`, falling back to `ubuntu-latest` when unset. This supports a trusted isolated Linux control pool without borrowing UT/BVT capacity. No pool has been provisioned or repository variable changed; operators must verify the pool before configuring its label. A configured but unavailable pool does not automatically fall back. This addresses allocation overhead and enables capacity isolation; it does not claim to resolve GitHub-hosted capacity exhaustion by code alone. [Run 34571127635](https://github.com/matrixorigin/matrixone/actions/runs/34571127635), with failed producers and a queued summary, illustrates the separate capacity case. An older MatrixOne ALL CI run can keep its branch concurrency group after cancellation because `CI Required` uses `always()` and is queued for a runner. In [run 34575985362](https://github.com/matrixorigin/matrixone/actions/runs/34575985362), UT, SCA, coverage and BVT were cancelled, but the summary stayed queued; [successor 34578155424](https://github.com/matrixorigin/matrixone/actions/runs/34578155424) remained pending with zero jobs. Add an independent `workflow_run: requested` controller outside the blocked concurrency group. It requests normal cancellation for older matching runs, allows a shared two-minute cleanup grace, then force-cancels survivors through GitHub's API. Match workflow/event, head repository ID, branch, run ordering and attempt/start-time fences; recheck targets before mutation. Handle normal-cancellation 409 conflicts through fresh state inspection and retain visible failures for permission/transport errors. No older matching runs means no polling wait. Keep the strict `CI Required` verifier and its `always()` condition: making the only protected check skip on cancellation could allow incomplete CI to count as successful. Bound summary execution to five minutes. The controller reads only its trusted workflow revision, never PR code or artifacts, and does not write check conclusions. Its `actions: write` permission is isolated to the new workflow. The default-branch-only manual dispatch accepts a successor run ID for recovery after reruns, since GitHub does not emit `workflow_run: requested` for reruns. Document cancellation semantics and rollout limits, and include the new contracts in the existing secret-free CI scope test workflow. ### Validation - `node --test .github/ci/*.test.cjs`: 26 tests passed, including normal teardown, stuck summary escalation, strict required-check rejection, BVT plan validation, modern/3.0 preflight routing, configurable runner fallback, cross-fork/branch/workflow exclusions, delayed events, rerun fences, completion races, 409/403/500 responses and bounded discovery. - `go run github.com/rhysd/actionlint/cmd/[email protected] .github/workflows/ci-cancellation.yml .github/workflows/entrypoint.yaml .github/workflows/ci-scope-check.yml`: passed. - `git diff --check`: passed. - Independent GPT-6 medium final review: no blocking findings; reviewer also ran all 26 tests. ### Rollout and limitations The controller must land on the default branch before the workflow_run trigger is active. Post-merge acceptance must confirm a pending successor triggers recovery, an older stuck run reaches a terminal state, and the successor starts. Local tests mock API state transitions; they do not prove GitHub scheduler behavior. No live workflow was cancelled during validation. Both the controller and summary still need a hosted runner; execution timeouts do not bound queue delay. Force cancellation after the grace may interrupt remaining old-run diagnostics, and API acceptance is not proof of runner teardown. Cancellation and state reads are not atomic. A manually cancelled run with no successor is outside automatic recovery scope. Test suites, coverage requirements and branch protection are unchanged.
## What type of PR is this? - [x] Documentation - [x] Test and CI ## Which issue(s) this PR fixes: Related to #30150 for the required check on cancelled producers. The rollout uses the control runner support from #28717 and addresses the queue observed on #33494 and #33501. ## What this PR does / why we need it: On #33501 the old required check waited 7m35s for a hosted runner and ran for four seconds. The replacement workflow was unable to start preflight during that wait. On #33494 the old required check and the cancellation controller also queued together. [Required check from #33501](https://github.com/matrixorigin/matrixone/actions/runs/46374859836/job/141702801415) · [Required check from #33494](https://github.com/matrixorigin/matrixone/actions/runs/46368023504/job/141705095759) The repository setting for preflight, the required check and the cancellation controller now selects the shared CS medium pool. This update records the operational setting and how to restore hosted execution and release a superseded run if a runner label stops serving work. Two simultaneous jobs using the shared label started on MTY and RUH in 7 and 11 seconds. A hosted reference submitted with them waited 61 seconds. JED and MNL2 also ran the same checkout, PR metadata read and required-check verification. [Shared-label comparison](https://github.com/matrixorigin/matrixone/actions/runs/46378188128) · [JED and MNL2](https://github.com/matrixorigin/matrixone/actions/runs/46380046197) In a branch-isolated handoff, cancellation made the old required check fail and the successor reached a runner 50 seconds after its workflow was created. A second exercise held the old required check on a nonexistent label, restored the hosted default for the successor, and used GitHub's force-cancel operation on the obsolete probe. The 65 existing scope and cancellation tests passed locally. [Cancelled producer](https://github.com/matrixorigin/matrixone/actions/runs/46379765379) · [Successful successor](https://github.com/matrixorigin/matrixone/actions/runs/46379836410) · [Hosted recovery](https://github.com/matrixorigin/matrixone/actions/runs/46380130392) After the repository setting changed on November 30 at 08:20 UTC, the production preflight picked up this main PR on RUH in 15 seconds and a 4.2-dev PR on MTY in 5 seconds. The cancellation controller for this PR picked up on RUH in 10 seconds. [Main preflight](https://github.com/matrixorigin/matrixone/actions/runs/46380837572/job/141720723388) · [4.2-dev preflight](https://github.com/matrixorigin/matrixone/actions/runs/46381492276/job/141721422578) · [Cancellation controller](https://github.com/matrixorigin/matrixone/actions/runs/46380847802/job/141719313212) On main PR #33502 the deployed controller picked up on RUH in 11 seconds, waited the existing grace period, and automatically force-cancelled the superseded run while its hosted required check was queued. The successor preflight picked up on MTY in 5 seconds. From the new workflow being created to preflight starting took 2m48s. This documentation PR's required check also passed on MTY after a 6-second queue. [Automatic cancellation](https://github.com/matrixorigin/matrixone/actions/runs/46382877728/job/141725947578) · [Successor preflight](https://github.com/matrixorigin/matrixone/actions/runs/46382871951/job/141727210246) · [Passing required check](https://github.com/matrixorigin/matrixone/actions/runs/46380837572/job/141731647152)
What type of PR is this?
Which issue(s) this PR fixes:
Related to #28419 (required-check handling of cancelled CI producers).
What this PR does / why we need it:
Reduce lightweight CI queueing by combining PR validation, change classification and complementary BVT planning into one
CI preflightjob. Full/BVT preparation uses one runner allocation instead of three; UT/docs preparation uses one instead of two. Preserve all scope routes, coverage generation wiring and 3.0-dev validation behavior. The strict verifier rejects failed, cancelled or incomplete preflight results and invalid BVT group plans.Preflight,
CI Requiredand the independent cancellation controller use optionalCI_CONTROL_RUNNER_LABEL, falling back toubuntu-latestwhen unset. This supports a trusted isolated Linux control pool without borrowing UT/BVT capacity. No pool has been provisioned or repository variable changed; operators must verify the pool before configuring its label. A configured but unavailable pool does not automatically fall back. This addresses allocation overhead and enables capacity isolation; it does not claim to resolve GitHub-hosted capacity exhaustion by code alone. Run 34571127635, with failed producers and a queued summary, illustrates the separate capacity case.An older MatrixOne ALL CI run can keep its branch concurrency group after cancellation because
CI Requiredusesalways()and is queued for a runner. In run 34575985362, UT, SCA, coverage and BVT were cancelled, but the summary stayed queued; successor 34578155424 remained pending with zero jobs.Add an independent
workflow_run: requestedcontroller outside the blocked concurrency group. It requests normal cancellation for older matching runs, allows a shared two-minute cleanup grace, then force-cancels survivors through GitHub's API. Match workflow/event, head repository ID, branch, run ordering and attempt/start-time fences; recheck targets before mutation. Handle normal-cancellation 409 conflicts through fresh state inspection and retain visible failures for permission/transport errors. No older matching runs means no polling wait.Keep the strict
CI Requiredverifier and itsalways()condition: making the only protected check skip on cancellation could allow incomplete CI to count as successful. Bound summary execution to five minutes. The controller reads only its trusted workflow revision, never PR code or artifacts, and does not write check conclusions. Itsactions: writepermission is isolated to the new workflow.The default-branch-only manual dispatch accepts a successor run ID for recovery after reruns, since GitHub does not emit
workflow_run: requestedfor reruns. Document cancellation semantics and rollout limits, and include the new contracts in the existing secret-free CI scope test workflow.Validation
node --test .github/ci/*.test.cjs: 26 tests passed, including normal teardown, stuck summary escalation, strict required-check rejection, BVT plan validation, modern/3.0 preflight routing, configurable runner fallback, cross-fork/branch/workflow exclusions, delayed events, rerun fences, completion races, 409/403/500 responses and bounded discovery.go run github.com/rhysd/actionlint/cmd/[email protected] .github/workflows/ci-cancellation.yml .github/workflows/entrypoint.yaml .github/workflows/ci-scope-check.yml: passed.git diff --check: passed.Rollout and limitations
The controller must land on the default branch before the workflow_run trigger is active. Post-merge acceptance must confirm a pending successor triggers recovery, an older stuck run reaches a terminal state, and the successor starts. Local tests mock API state transitions; they do not prove GitHub scheduler behavior. No live workflow was cancelled during validation.
Both the controller and summary still need a hosted runner; execution timeouts do not bound queue delay. Force cancellation after the grace may interrupt remaining old-run diagnostics, and API acceptance is not proof of runner teardown. Cancellation and state reads are not atomic. A manually cancelled run with no successor is outside automatic recovery scope. Test suites, coverage requirements and branch protection are unchanged.