Skip to content

ci: defer the Kind smoke on draft PRs - #1286

Merged
zibi-pplx merged 1 commit into
mainfrom
zibi/kind-draft-defer-8core
Nov 2, 2026
Merged

zibi-pplx merged 1 commit into
mainfrom
zibi/kind-draft-defer-8core

Conversation

@zibi-pplx

@zibi-pplx zibi-pplx commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

A draft PR no longer runs the Kind smoke on every push. While a Kind-path PR is a draft, Kind is deferred and space-pull-ci fails, so it cannot merge on a run that skipped Kind. The smoke runs when the PR is marked ready for review, or from the next push after the new kind-smoke label is added.

Why. On a public repository, GitHub-hosted larger runners are the only Actions minutes that are billed, and the Kind shards use most of ours. Kind job data for 2026-10-30 to 2026-11-01 (about 2.3 days):

  • Where 16-core minutes went: Kind shards on PRs 62.5%, Kind shards on main pushes 9.7%, everything else 27.8%.
  • How often Kind runs: 31 PRs ran Kind 150 times, 4.8 runs per PR. One 8-shard Kind run is about 125-140 runner-minutes.
  • Drafts: 74% of the PR Kind minutes that could be attributed to a PR ran while that PR was a draft.

What changes.

  • Pull CI also triggers on ready_for_review.
  • On a draft that changes a Kind path, ci/scripts/kind-pull-needed.sh answers deferred, with a "Kind smoke deferred" notice. Kind does not run, and space-pull-ci's gate fails with the reason.
  • Why the deferral fails rather than passes: a passing deferred run would stay the head's only space-pull-ci for about 20 minutes after the PR is marked ready, while the ready run's Kind is still in progress. A rerun of a draft-time run would also defer again and post a newer green. Either could let an approved PR merge without Kind on its final head; a failing deferral closes both.
  • Marking the PR ready runs the smoke on the same head.
  • The kind-smoke label opts a draft in. The label is read from the event, so it applies from the next push.
  • A malformed draft or opt-in value fails the selection instead of guessing.
  • CONTRIBUTING.md tells contributors when Kind runs, that converting back to a draft defers it again, and that someone with triage access adds kind-smoke.

Expected savings, as shares of the 16-core runner cost:

Change Estimate Assumption
Defer Kind on drafts 30-45% removes up to 74% of PR Kind shard minutes, less whatever drafts opt in
Ready-for-review rerun about +1% marking a PR ready reruns all of Pull CI once on that head

An earlier head of this PR also moved the shards to 8-core runners. On one run (run) that cut the run's cost by about 38% but made it 3.6 minutes slower: 24.4 min against 20.8 on 16 cores, with bring-up 38% slower. Latency matters more than cost here, so the shards stay on 16 cores.

Validation

  • ci/scripts/test-kind-pull-needed.sh passes in a Linux container. Its new cases cover:

    • a draft is deferred, with a reason;
    • an opted-in draft and a ready PR run Kind;
    • an opted-in draft that changes no Kind path does not;
    • malformed flags fail.

    It fails on main's version of the selector.

  • Pull CI's YAML parses.

  • In CI, with disposable probes:

    • an earlier head deferred Kind on a draft and ran it on the same head once marked ready (draft run, ready run);
    • at this head, a Kind-path draft answered deferred, skipped Kind and failed space-pull-ci with the deferral message (run).

Severity and risk

Severity: does not apply; this is a CI cost reduction.

Risk:

  • Feedback on drafts. Authors get no automatic Kind feedback on drafts, and a Kind-path draft shows a red space-pull-ci until it is ready or opted in.
  • Reruns. Rerunning a draft-time run after the PR is ready still defers Kind, because a rerun keeps its original event. It now fails rather than passing; push or mark ready again instead.
  • Rollback. Revert this PR.

AI assistance: Claude Code drafted the change, its tests and this description.

🤖 Generated with Claude Code

@zibi-pplx
zibi-pplx added this pull request to stack #1279 November 2, 2026 12:55
@zibi-pplx
zibi-pplx removed this pull request from stack #1279 November 2, 2026 12:57
@zibi-pplx
zibi-pplx changed the base branch from pr1268 to main November 2, 2026 12:57
@zibi-pplx
zibi-pplx force-pushed the zibi/kind-draft-defer-8core branch from 781e6d3 to fef42c0 Compare November 2, 2026 12:58
@zibi-pplx
zibi-pplx force-pushed the zibi/kind-draft-defer-8core branch 2 times, most recently from de494f3 to 5b8b0ea Compare November 2, 2026 13:45
@zibi-pplx zibi-pplx changed the title ci: defer the Kind smoke on draft PRs and run its shards on 8-core runners ci: defer the Kind smoke on draft PRs Nov 2, 2026

@ac-pplx ac-pplx 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 CI runs the Kind/Firecracker smoke, eight billed 16-core shards, on every push of a pull request that changes a Kind path, drafts included, and drafts cannot merge. This PR defers the smoke while the PR is a draft (unless it carries kind-smoke) and reruns Pull CI on ready_for_review, so Kind runs on the head that can merge. The deferral itself works: the probe PR #1291 shows the notice, KIND_NEEDED: false and a skipped Kind on the draft, then Kind on the same head once marked ready.

The gap is what space-pull-ci shows on that head in between, from the same probe:

14:03:52  opened as a draft -> run A defers Kind; space-pull-ci SUCCESS at 14:09:34
14:10:05  marked ready -> run B starts on the same head and runs Kind
14:10-14:30  the only space-pull-ci check run on the head is A's success
          (B's space-pull-ci job is created at 14:30:01, once its needs finish)

Verdict: Changes requested; 2 threads.

Before merge (inline threads)

  1. A run that skipped Kind can stand as the head's required check after the PR is ready
  2. The contributor docs and two headers describe the rule incompletely

Nits

  • The Validation section says the draft deferral was not yet observed in CI. #1291 observed both halves (draft run, ready run); cite it.
  • pull-ci.yml:50 says each shard takes a 16-core runner. #1289 would make that 32 cores; "a large runner per shard" holds either way.

Comment thread .github/workflows/pull-ci.yml Resolved
Comment thread CONTRIBUTING.md Resolved
16-core runners are the only Actions minutes a public repository pays
for, and Kind shards use most of them. Kind reruns on every push of a
PR that changes a Kind path, and most of those runs were drafts'
intermediate pushes.

Pull CI now also triggers on ready_for_review. While a PR is a draft,
kind-pull-needed.sh answers `deferred` for a Kind path unless the PR
carries the kind-smoke label, read from the event, so the label applies
from the next push. A deferred run skips Kind and fails space-pull-ci
with a notice, so a pull request cannot merge on a run that skipped
Kind: not on a draft-time success that is still the head's only check
while the ready run's Kind is in progress, and not on a rerun of a
draft-time run. Marking the PR ready runs the smoke on the same head.
@zibi-pplx

Copy link
Copy Markdown
Collaborator Author

Thanks for the review. Both threads are fixed in a60ffe4. Nits:

@zibi-pplx
zibi-pplx requested a review from ac-pplx November 2, 2026 21:16

@ac-pplx ac-pplx 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.

Round 2 at a60ffe4. Every item from the last review is fixed:

  • A draft that changes a Kind path now answers deferred, and the gate fails it. So a Kind-skipped run can no longer stand as a ready head's required check: not in the window before the ready run's space-pull-ci posts, not on a re-run of a draft-time run, and not when a late push run cancels the ready run. The probe at this head shows it end to end (run): KIND_NEEDED: deferred, Kind skipped, space-pull-ci failed with the deferral message.
  • CONTRIBUTING, both headers, the workflow comment and the commit message now describe the rule as it runs. Each holds on every path I checked: an unlabelled Kind-path draft, a labelled draft, a draft with no Kind path, and a draft converted back from ready.
  • With the cancelled-run fallback now on main, a deferred run ends as a failure, so the fallback cannot take it as the passing sibling. The two edits merge cleanly.

Verdict: Approved.

@zibi-pplx
zibi-pplx added this pull request to the merge queue Nov 2, 2026
Merged via the queue into main with commit f0e9855 Nov 2, 2026
33 checks passed
@zibi-pplx
zibi-pplx deleted the zibi/kind-draft-defer-8core branch November 2, 2026 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants