Repository navigation
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.
Force review of ac9441b against base/merge-base 2a6fe7f. COMMENT only (self-authored PR).
Design decision: PASS for docs/design/ci_required_fail_fast_cancellation.md at this exact head, Git blob 0f3e580256e3015668418d377db114307d0acd31. I reviewed the design before completing implementation acceptance; the separate design-first commit is 46bfd5b. This comment records the precise independent decision rather than relying solely on the PR body's earlier unlinked PASS assertion. The required-job authority, default-branch trust boundary, rollout exclusions, policy-drift behavior, bounded controller lifetime, and non-atomic cancellation limitation are explicit and acceptable for the stated best-effort resource-saving contract.
Implementation conclusion: no concrete blocker found. Cancellation requires an exact authorized terminal failed job in the same run attempt, trigger-time metadata, matching local gate blobs, and (for external jobs) the reviewed immutable reusable-workflow SHA. Pending/in-progress, skipped, neutral, unrelated job names, old attempts, unsupported workflow revisions and 3.0-dev do not grant authority. The unchanged scope guards ensure active authorized jobs belong to that run's gate closure. A single failed required dependency is sufficient to doom the AND gate; other dependencies need not finish first. Existing CI Required display name/dependencies are preserved.
I checked the supported external workflow revision 2ab1af3a85ca3c4e4eab7483201aca3e1913dd99 and the authorized job failure propagation. I also inspected real Actions run metadata: run.head_sha and referenced_workflows path/SHA fields match the representation consumed here. The final run status/attempt/head recheck rejects stale decisions; 409 is treated as a race, other errors are surfaced, and processing continues safely for other runs. There is deliberately no API call against a different run/workflow or PR-selected code. Default-branch-only dispatch, pinned controller actions, sparse trusted checkout, disabled persisted credentials and contents:read/actions:write preserve the intended boundary.
Q1/Q2/Q3: no persistent external worker is introduced; scans are serialized, jobs/runs are paginated, policy lookups are cached per base SHA, mutation is sequential, and the workflow has a five-minute timeout. Summary rows are capped at 100. Large backlogs or API throttling may reduce progress before timeout, but do not authorize uncertain cancellations. Cancellation sacrifices remaining diagnostic/coverage work only in a run already unable to satisfy the required gate; it does not claim those interrupted tests passed.
Accepted operational limitations: GitHub's cancel API has no attempt precondition, so completion plus rerun between the final GET and POST remains a documented residual race, not atomic compare-and-cancel. A change to local gate blobs or any unapproved external revision pauses watchdog authority until reviewed. Scheduled enforcement is active after merge; perform the documented trusted dry-run promptly and monitor watchdog errors rather than interpreting them as product-test failures.
Validation: all 21 exact-head Node tests passed using read-only git-object loading; git diff --check passed. Inspected current diff, commit sequence, PR/issue comments and live API shapes. No live cancellation, full CI wait, or feature-branch execution with actions:write was performed. No performance saving is asserted beyond the design's expected earlier release of doomed-run resources.
|
Tick the box to add this pull request to the merge queue (same as
|
## What type of PR is this? - [ ] API-change - [ ] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related to #28419 (CI Required / coverage failure reporting) Related to #27291 and #27293 through #28529's CI startup blocker ## What this PR does / why we need it: `pull_request_target` currently checks out `.github/ci` from the pull request base SHA in the `change-scope` and `ci-required` jobs. A `4.2-dev` pull request can therefore load a workflow that references `change-scope.cjs` while its base commit does not contain that helper, failing before product tests start with `Cannot find module '.github/ci/change-scope.cjs'`. Both jobs now load the repository-owned CI helper from `${{ github.workflow_sha }}`, the commit that supplied the running workflow. The PR base and head SHAs remain event metadata only, and all checkout credentials remain disabled. A checkout-independent provenance step writes the workflow, base, and head SHAs before loading the helper, so missing-helper or checkout failures retain diagnostics. No test routing, required-check policy, or product code is changed. The existing `3.0-dev` route and failure semantics remain unchanged. This PR is intentionally separate from #28591, whose purpose is cancelling doomed PR runs. ## Validation - Baseline red check: the old workflow fails the trusted workflow-SHA checkout contract. - `node --test .github/ci/change-scope.test.cjs` (10/10 passed) - The fixture parses the actual checkout configuration for both jobs, resolves the event expressions against separate base/workflow/head trees, and executes the selected workflow helper. The base tree lacks the helper, the workflow tree contains the trusted classifier and verifier, and the head tree contains a malicious same-name helper. Both jobs select the workflow tree; the classifier and `verifyResults` are executed from that same trusted version. - The contract test rejects a floating `main` ref, requires provenance before checkout, and executes the provenance shell against a simulated checkout failure to verify the summary remains available. - `actionlint v1.7.12 .github/workflows/entrypoint.yaml` (passed) - `git diff --check` (passed) - The first CI run was correctly blocked by an invalid PR reference to #28529 (a PR, not an issue). The body now references valid issues #28419, #27291, and #27293. - After this PR merges, GitHub's `pull_request_target` behavior uses the repository default-branch workflow source; a fresh #28529 run can therefore be created directly without a `4.2-dev` CI-file backport. That run must prove the workflow SHA contains this fix, classification succeeds, and required tests actually start. See [GitHub's change](https://github.blog/changelog/2025-11-07-actions-pull_request_target-and-environment-branch-protections-changes/). QA required: no; this is a workflow/test-only change and does not alter MatrixOne runtime behavior. Complete CI startup and classification validation is a post-merge check. --------- Co-authored-by: XuPeng-SH <[email protected]>
ac9441b to
05eb70b
Compare
05eb70b to
0a76bde
Compare
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep review of b73dfc45befd756a794e345bc51f7f148c91a39b (self-authored PR; comment only).
P2 blocker: compare policy at the workflow revision that actually ran, not the PR target branch tip.
cancel-doomed-runs.cjs obtains local policy blobs at metadata.baseSha (the run name records github.event.pull_request.base.sha). But this pull_request_target entrypoint loads its preflight and gate scripts from github.workflow_sha; the event executes the trusted default-branch workflow. Those revisions are not interchangeable.
Concrete case: current 4.2-dev tip is 7d150ee116c705c47a9106ad5ff86aed7e592b7d; it has no .github/ci/change-scope.cjs (Contents API returns 404). After merge, a PR targeting 4.2-dev runs the main/default-branch gate, but this watchdog looks up the release-branch blob and rejects every run before inspecting jobs. Thus doomed release-target CI runs are never cancelled, and the watchdog reports errors for healthy runs too.
Please include workflow_sha=${{ github.workflow_sha }} in strict run metadata and compare the policy blobs at that immutable SHA. Keep baseRef for the 3.0-dev exclusion and baseSha only for diagnostics. Add a test where workflow SHA differs from base SHA: matching blobs at workflow SHA must authorize; a mismatch at workflow SHA must fail closed even if base blobs match. Update the design's provenance wording.
This review otherwise found the exact-head required-job policy, attempt checks, permissions boundary, cancellation race handling, and tests coherent. Exact-head CI and scope contract are green; the issue is specifically the policy provenance mismatch above.
b73dfc4 to
db6cadb
Compare
db6cadb to
5a97c50
Compare
XuPeng-SH
left a comment
There was a problem hiding this comment.
GPT-6 medium deep review at head dc2e50cdd64e26de9ba556f3a7194349b3e853ca: no blockers or material gaps found. Reviewed caller/gate conditions, rerun and cancellation races, trust boundaries, and Mergify interaction. The CI scope contract reports 42/42 tests passed, including watchdog tests; no additional unhandled race was verified beyond the documented GitHub cancel endpoint window.
|
Pure rebase update: started from remote head |
XuPeng-SH
left a comment
There was a problem hiding this comment.
GPT-6 medium deep review at exact head 0f2741d.
I reviewed the doomed-run cancellation/watchdog path and its tests; I found no verified blocker on this head. The watchdog test is 1.13 ms and the Node suite passed. This is a comment-only review because the PR is self-authored.
|
Post-rebase status: the PR branch is now at |
XuPeng-SH
left a comment
There was a problem hiding this comment.
GPT-6 medium deep review at 2e5be160fa81195262e291ef2d24b0bb5161958f — PASS; no blocking findings.
I reviewed the watchdog’s trigger-time provenance, local policy-blob equality, exact required-job classification, external reusable-workflow revision allowlist, latest-attempt filtering, and pre-cancel run-state recheck. The final revision correctly keys local policy validation to the workflow SHA recorded by the PR-target run, rather than the target branch’s base SHA; unknown or drifted policy revisions fail closed. The scheduled workflow is restricted to the default branch and grants only actions:write/contents:read; manual dispatch defaults to dry-run. Current-head CI is green. No live cancellation was exercised during this review.
XuPeng-SH
left a comment
There was a problem hiding this comment.
PASS — fresh Astra medium deep review of 8b33652c453031baab87e96c2f439b47e8757b55; COMMENT only because this is self-authored. No actionable P0–P2 findings.
Reviewed the complete watchdog/controller/reusable-workflow chain and the delta from the previous reviewed head 2e5be160; the six PR files are unchanged. Verified strict policy/workflow-SHA validation, exact required-job classification, latest-attempt filtering, reusable-workflow provenance, final run-state recheck, scoped cancellation, and fail-closed behavior. Contract validation passed 42/42 on the identical tree; git diff --check passed.
Residual evidence gaps: no live dry-run/cancellation exercise; pagination/rate-limit behavior is mocked; the documented GET→POST rerun race remains. Current external CI revision bff80f0f… is not allowlisted, so cancellation remains disabled for that revision until reviewed.
What type of PR is this?
Which issue(s) this PR fixes:
Related to #28419
What this PR does / why we need it:
When one dependency of
CI Requiredhas already failed, the PR workflow cannot become green, but sibling test jobs can keep consuming runners for tens of minutes.This adds a repository-owned watchdog that scans every five minutes and cancels doomed, in-progress PR workflows. Cancellation fails closed: it checks trigger-time metadata, matching local gate-policy blobs, exact required-job names, an approved immutable reusable-workflow revision, and the final run attempt/status before acting. Failures in non-gating jobs such as Utils, Upgrade, Shared Build, CodeQL, and TKE are ignored. Old runs,
3.0-devruns, changed policies, and unknown external revisions are left untouched and reported.The controller runs only from the default branch, checks out trusted CI code with persisted credentials disabled, and has only
contents: readplusactions: write. Manual dispatch defaults to dry-run. Its bounded summary reports cancellations, races, skips, inspection errors, failed job, and conclusion. The currently approved MatrixOrigin CI workflow revision ise43e7077e87ebdcefa66b12e3b1778b984cc3ce2; unsupported revisions fail closed.Design:
docs/design/ci_required_fail_fast_cancellation.mdValidation on base
4f9d170a22deaabc2eee6b239a51a8cb40a39f9f:node --test .github/ci/change-scope.test.cjs .github/ci/cancel-doomed-runs.test.cjs(28/28 passed)GOWORK=off go run github.com/rhysd/actionlint/cmd/[email protected] .github/workflows/entrypoint.yaml .github/workflows/cancel-doomed-pr-ci.yamlgit diff --check origin/main...HEAD