Skip to content

ci: skip TheRock CI matrix on draft pull requests - #10752

Merged
tony-davis merged 7 commits into
developfrom
users/todavis/skip-ci-on-draft-prs
Aug 19, 2026
Merged

tony-davis merged 7 commits into
developfrom
users/todavis/skip-ci-on-draft-prs

Conversation

@tony-davis

@tony-davis tony-davis commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

TheRock CI currently launches the full Linux/Windows build+test matrix on every push to a PR, including while it's still a draft. This skips that matrix for draft PRs and instead fires it once when a PR is marked "Ready for review", so work-in-progress pushes stop burning shared build-runner capacity.

Risk Assessment

Risk 2/5. CI-trigger-only change, no product or test behavior change. The draft-skip logic lives entirely in therock_configure_ci.py: the setup job always runs to completion (it is never itself skipped), and for a draft PR the script returns an empty project list before doing any path-diffing work. That means the pre-existing, unmodified needs.setup.outputs.linux_projects != '[]' gate on the build/test jobs handles the skip, with no if: always() / skip-cascade logic for the required TheRock CI Summary check to get wrong (see review discussion below for the earlier, more fragile version of this approach).

Related

Device / Architecture Coverage

No product/device code changes; this is CI wiring only. Passing PR CI is sufficient to merge.

Testing Summary

  • Unit tests: python -m pytest .github/scripts/tests/therock_configure_ci_test.py -- 36 passed (3 new: draft-PR skips CI without diffing paths, ready-for-review runs CI normally, is_draft ignored on non-pull_request events).
  • Lint/format: pre-commit run --files .github/workflows/therock-ci.yml .github/scripts/therock_configure_ci.py .github/scripts/tests/therock_configure_ci_test.py passed.
  • Live verification on the final (Python-based) revision, on this PR:
    • Converted to draft, pushed a no-op empty commit. Run 31750101133: Setup logs show is_draft: True -> "Pull request is a draft, skipping CI" -> linux_projects: '[]', windows_projects: '[]'; Linux/Windows matrix jobs skipped; required TheRock CI Summary check success.
    • Reverted the no-op commit (forward commit, no history rewrite), then marked "Ready for review" with no further push. Run 31750369870 fired immediately via the ready_for_review trigger, Setup succeeded, and the full Linux/Windows build matrix launched normally (~25 build jobs across all projects/GPU families).
    • Also observed the workflow's existing concurrency group correctly cancel the stale draft-state run the moment the ready-for-review run started, avoiding a redundant in-flight run.
  • Earlier (superseded) revision of this PR used a YAML-only if: on the setup job instead of the Python-side skip; that revision was also live-verified the same way (run 31725884279 draft-skip, run 31726513075 ready-for-review) before being replaced per review feedback (see Technical Changes).

Testing Checklist

  • Unit tests - pytest .github/scripts/tests/therock_configure_ci_test.py - Status: Passed (36/36)
  • pre-commit hooks - pre-commit run --files ... - Status: Passed
  • Draft-PR skip verification (final revision) - Setup succeeds with empty project lists, Linux/Windows skipped, TheRock CI Summary success - Status: Passed
  • ready_for_review trigger verification (final revision) - marking ready (no push) fired a new TheRock CI run and launched the full build matrix - Status: Passed
  • PR CI - GitHub PR checks - Status: Pending (full build matrix launched by the ready-for-review test above, at run 31750369870; not yet complete)

Flags / Guardrails

None. Behavior is unconditional (no opt-out flag) since it only affects draft-state PRs, which are never merge-ready by definition.

Adjacent Tests Considered

Checked the other pull_request_target-triggered bot (libraries-pr-bot.yml) -- it already has a block_draft policy hook (currently disabled) and is unaffected by this change since it's a separate workflow. No other caller references therock-ci.yml as a reusable workflow (it's only invoked via its own on: triggers), so no interface/caller updates are needed.

Risk Acceptance / Waivers

None needed.

Technical Changes

  • Add ready_for_review to the pull_request trigger types, so CI fires immediately when a draft PR is marked ready instead of waiting for the next push.
  • Add an IS_DRAFT env var (from github.event.pull_request.draft) to the "Determine Linux/Windows projects to run" steps.
  • In therock_configure_ci.py, retrieve_projects() now returns an empty project list immediately for a draft pull request, before diffing modified paths. The setup job itself is never skipped; the pre-existing needs.setup.outputs.*_projects != '[]' gate on the build/test jobs handles the rest unchanged.
  • Add unit tests covering the draft-skip behavior in therock_configure_ci_test.py.

Review history: an earlier revision implemented the skip via a job-level if: on setup plus needs.setup.result == 'success' on the downstream jobs. @geomin12 flagged that relying on Actions' skip-cascade semantics for a required check is fragile; this revision addresses that by keeping setup always-green and pushing the skip decision into testable Python instead.

Add ready_for_review to the pull_request trigger types, skip the setup
job while a PR is a draft, and make the downstream Linux/Windows jobs
require needs.setup.result == 'success' so a skipped setup correctly
cascades instead of running with empty inputs.

Fixes #10751

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions github-actions Bot added github actions project: none Does not target any component labels Aug 13, 2026
@therock-pr-bot

therock-pr-bot Bot commented Aug 13, 2026 •

Copy link
Copy Markdown

✅ All Checks Passed — Ready for Review

Check Status Details
📝 PR Description ✅ Pass —
⛔ Forbidden Files ✅ Pass —
🧪 Unit Test ✅ Pass —
🔎 pre-commit ✅ Pass —
🚫 Draft PR 🔜 To Be Enabled —
🚩 Feature Flag 🔜 To Be Enabled —
📊 Code Coverage 🔜 To Be Enabled —
🤖 therock-pr-bot ✅ Pass —

🎉 All checks passed! This PR is ready for review.

📖 Need help? See the Policy FAQ for details on every check and how to fix failures.

🙋 Wish to Override Policy?

@therock-pr-bot

Copy link
Copy Markdown

🎉 All checks passed! This PR is ready for review.

@tony-davis
tony-davis marked this pull request as ready for review August 13, 2026 17:35
@tony-davis
tony-davis requested a review from a team as a code owner August 13, 2026 17:35
Copilot AI lite review requested due to automatic review settings August 13, 2026 17:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts the TheRock CI GitHub Actions workflow to avoid running the full Linux/Windows build+test matrix for draft pull requests, while still running it automatically once the PR is marked “Ready for review”, reducing unnecessary CI runner usage during WIP iteration.

Changes:

  • Add ready_for_review to the pull_request trigger types so CI fires immediately when a PR leaves draft state.
  • Skip the setup job on draft PRs (while keeping non-PR triggers unaffected).
  • Ensure the Linux/Windows matrix jobs explicitly require needs.setup.result == 'success' so they correctly cascade when setup is skipped.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/workflows/therock-ci.yml Resolved
Address review feedback: relying on GitHub Actions' if: always() +
needs.<job>.result skip-cascade semantics for a required check is
fragile. Instead, always run setup to completion; the Python config
script now returns an empty project list for draft PRs before doing
any path-diffing work, so the pre-existing
needs.setup.outputs.*_projects != '[]' gate on the build/test jobs
skips them without any special-casing.

Co-authored-by: Cursor <cursoragent@cursor.com>
@tony-davis
tony-davis marked this pull request as draft August 13, 2026 22:28
tony-davis and others added 2 commits August 13, 2026 17:28
Co-authored-by: Cursor <cursoragent@cursor.com>
This reverts commit 1f885f13788ec69ac979b4f4c15b6f0e5f2f7c05.

(No content changes to revert since the original commit was empty; this is a forward no-op commit purely to remove the test marker from history.)

Co-authored-by: Cursor <cursoragent@cursor.com>
@tony-davis
tony-davis marked this pull request as ready for review August 13, 2026 22:32
@tony-davis
tony-davis requested a review from geomin12 August 13, 2026 22:35
tony-davis added a commit that referenced this pull request Aug 13, 2026
## Summary

Extends the existing auto-retry watcher (added in #9174, #9658) to also
cover the per-PR `TheRock CI` workflow. Unlike the nightlies (4 total
attempts), it gets only 1 auto-retry (2 total attempts) so a genuine
regression still surfaces quickly and flaky infra doesn't multiply
runner usage on every PR push.

## Risk Assessment

Risk 2. One-file change to an isolated CI orchestration workflow; no
product code, reusable-workflow interface, or build/test lane is
touched. It only acts on runs that already concluded `failure`, and the
per-workflow attempt cap bounds worst-case runner usage. This is the
same mechanism already proven on the nightlies (#9174, #9658), just
applied to a second, lower-cap workflow name.

## Related

- Work tracking: #10762 (Closes)
- Related PRs: #9174, #9658 (nightly predecessors), #10752 (restricts
`TheRock CI` to non-draft PRs -- complementary, reduces overall run
volume)

## Device / Architecture Coverage

Architecture-independent. This is CI orchestration only (it calls the
GitHub API to re-run jobs); it runs no device code and needs no per-arch
verification.

## Testing Summary

- YAML parses cleanly (`python -c "import yaml;
yaml.safe_load(open('.github/workflows/auto-retry-failed.yml'))"`).
- `pre-commit run --files .github/workflows/auto-retry-failed.yml`
passed locally (trailing-whitespace, end-of-file-fixer, check-yaml).
- Functional behavior can only be exercised on the default branch,
because `workflow_run` always uses the copy of this file on `develop`.
Plan: watch the first `TheRock CI` failure after merge and confirm it
gets exactly one auto-retry.

## Testing Checklist

- [x] YAML parse - `python -c "import yaml; yaml.safe_load(...)"` -
Status: Passed
- [x] pre-commit (formatting/yaml) - `pre-commit run --files
.github/workflows/auto-retry-failed.yml` - Status: Passed
- [ ] PR CI - GitHub PR checks - Status: Pending
- [ ] Post-merge observation - confirm a failed `TheRock CI` run gets
exactly 1 auto-retry - Status: Pending

## Flags / Guardrails

Per-workflow attempt cap via `run_attempt`: `TheRock CI` gets
`run_attempt < 2` (1 auto-retry, 2 total attempts); the two nightly
workflows keep the existing `run_attempt < 4` (unchanged). Only fires on
`conclusion == 'failure'`; `cancelled` (concurrency/superseded runs, or
a run with individually cancelled jobs -- `rerun-failed-jobs` never
touches those) and `startup_failure` are excluded. No new permissions;
reuses the existing `actions: write` grant.

## Adjacent Tests Considered

No product or test code changes. Checked that `TheRock CI`'s
`cancel-in-progress: true` concurrency interacts safely with a queued
retry: a new push cancels a stale retry, which is the desired behavior
(no point retrying stale code).

## Risk Acceptance / Waivers

`W-BUILD`: CI orchestration only, no product behavior change; mirrors
the already-proven nightly pattern from #9174/#9658.

## Technical Changes

- Add `"TheRock CI"` to the `workflow_run.workflows` list in
`.github/workflows/auto-retry-failed.yml`.
- Change the attempt-cap `if:` condition to branch by workflow name:
`run_attempt < 2` for `TheRock CI`, `run_attempt < 4` for everything
else (nightlies, unchanged).
- Update header/job comments to document the per-workflow cap and to
note that `rerun-failed-jobs` already excludes individually cancelled
jobs.

Co-authored-by: Cursor <cursoragent@cursor.com>

@geomin12 geomin12 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm but can you open a test draft PR and make sure this works as expected?

@tony-davis
tony-davis requested a review from geomin12 August 14, 2026 16:46
@tony-davis

Copy link
Copy Markdown
Contributor Author

lgtm but can you open a test draft PR and make sure this works as expected?

Thanks @geomin12 ! That evidence was in the description, and it's a good idea. Already executed.

@tony-davis
tony-davis enabled auto-merge (squash) August 14, 2026 21:43
@tony-davis
tony-davis merged commit 353fa10 into develop Aug 19, 2026
487 of 509 checks passed
@tony-davis
tony-davis deleted the users/todavis/skip-ci-on-draft-prs branch August 19, 2026 01:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TheRock CI runs full Linux/Windows builds on draft PRs

3 participants