Skip to content

🌱 Skip heavy CI jobs on refresh-only pull request heads - #19277

Open
clubanderson wants to merge 2 commits into
v5from
ci/refresh-only-skip-heavy
Open

clubanderson wants to merge 2 commits into
v5from
ci/refresh-only-skip-heavy

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Fixes #19276

What

Each hive App base refresh reran about 16 workflows (about 38 runner-minutes). This skips the three heaviest jobs on a head whose only change is that refresh:

  • docker.yml: the gate job gains a refresh-only check and the build, build-contributor, build-hub, build-mx jobs skip when it answers true. gate (required) still runs and succeeds.
  • fossa.yml: the scan, baseline and policy-test steps skip; the job reports success.
  • mutation-advisory.yml: setup, mutation run and comment upsert skip; the previous head's comment stays (same diff).

build-and-test, test shards, coverage and every other required context are untouched.

The proof (.github/scripts/refresh-only-head.sh)

Workflow form of HeadIsBaseRefreshOf in src/pkg/github/pr_decision_base_refresh.go. True only when all hold:

  1. same-repository pull_request synchronize;
  2. the new head is a GitHub-verified two-parent merge authored by hivecommons-hive[bot], committed by web-flow (or the App), with the previous head as a parent and the merge-base with the base as the other parent;
  3. git diff --raw --no-renames of the head against its base is identical to the previous head's (blobless clone, trees only, about 3s);
  4. the same workflow concluded success on the previous head, or (when that run was cancelled by the refresh) on an earlier head reached through at most 5 hops that each pass 2 and 3;
  5. the cumulative base delta touches no go.mod/go.sum/go.work, other dependency manifest or lock file, Dockerfile, .dockerignore, .fossa.yml, src/deploy/, .github/workflows/, .github/actions/, or the detector itself.

Fail safe: any lookup failure or doubt answers false (run everything), and the detector steps are continue-on-error, so a broken detector can never fail gate or skip anything. Each run writes skipped: refresh-only head. ... or refresh-only check: running everything (<reason>) to the step summary.

Checked by hand against live open PRs before pushing: a clean refresh whose previous FOSSA run passed answered true; the same head answered false for docker/mutation (previous runs cancelled, previous head not a refresh); a refresh bringing in src/Dockerfile answered false; an unsigned agent-pushed merge answered false; a merge that changed PR files answered false.

Protection

The helper lives under .github/scripts/, outside the TRUSTED_SCRIPTS_TREE pin on src/scripts (no src/scripts change, so no re-pin). gate, FOSSA and Mutation add actions: read to list earlier runs; gate gets job-level contents: read, actions: read (it pushes nothing).

Tests and docs

  • .github/scripts/test-refresh-only-head.sh: local git fixture over file:// plus a stubbed gh; covers the clean refresh, a two-hop walk, and every negative case. Wired into PR Auto-update Regression Tests.
  • New src/docs/ci-refresh-only-heads.md, linked from documentation-map.md and the final base preparation section of hive-merge.md.
  • changelog.d/changed-19276-ci-refresh-only-heads.md.

A hive App base refresh that leaves the PR's three-dot diff unchanged now
skips the Docker multi-arch build jobs, the FOSSA scan and the Mutation run
when the same workflow already passed on an earlier head and the base delta
touches no dependency, Dockerfile, deploy or CI path. Detection runs inside
the jobs, so required contexts (gate included) still report. Any doubt runs
everything.

Fixes #19276

Signed-off-by: Andy Anderson <andy@clubanderson.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Nov 19, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign hanthor for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow Bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Nov 19, 2026
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

Conflicts are checked with every PR merged onto the current tip of v5, so a PR that only needs a rebase is not reported as conflicting with its siblings.

PR Title Relation Files
#19280 🌱 Stop agents refreshing merely-behind PRs and track merge churn same files src/docs/hive-merge.md
#19206 ✨ ask: hive panel and rollout verification for optional Ask AI help same files src/docs/documentation-map.md
#19204 ✨ ask: hive backend and hub relay for optional Ask AI help same files src/docs/documentation-map.md
#19275 🐛 Coalesce base preparation refreshes and keep a ready owner in front same files src/docs/hive-merge.md

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor.

ℹ️ Sentinel: informational, author is trusted (owner), merge is not blocked. Head ec083d1cf6ca matched:

  • sensitive_path: changes 4 sensitive path(s) (.github/workflows/docker.yml, .github/workflows/fossa.yml, .github/workflows/mutation-advisory.yml, .github/workflows/pr-auto-update-test.yml)
  • ci_gate_weakening: CI configuration is deleted, softened or has gate checks removed (.github/workflows/docker.yml, .github/workflows/fossa.yml, .github/workflows/mutation-advisory.yml)

No sentinel-alert label was added. The finding is recorded in the dashboard Security tab and /api/sentinel; set sentinel.trusted_authors_block: true to block trusted authors too.

@hivecommons-hive hivecommons-hive Bot 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.

Decision needed: @clubanderson should decide whether skipping the Docker build, FOSSA and Mutation jobs on a verified base-refresh head (and the new actions: read / job-level permissions in the workflows) is acceptable CI policy.

I read .github/scripts/refresh-only-head.sh, its test, and the workflow edits in docker.yml, fossa.yml and mutation-advisory.yml. I found no defect. Every lookup failure in the script answers false ("run everything"), the steps are continue-on-error, and the gate job still runs, so the required context attaches as before. The body matches the diff.

This PR changes workflow definitions and permissions and decides which checks run on a PR head, which is a trust surface that needs a maintainer rather than a reviewer agent. Facts for the decision:

  • docker.yml gate now has job-level contents: read and actions: read, replacing the workflow-level permissions for that job.
  • The helper is checked out from the PR's own merge ref (actions/checkout with .refresh-check), so a PR that edits the helper controls its own answer. That is no worse than a PR editing the workflow itself, but it means the protection rests on the same-repo and App-signed-merge conditions, not on the script being pinned.
  • The sensitive-path list covers manifests, Dockerfiles, src/deploy/ and .github/workflows/, so a refresh that pulls in those changes still runs everything.

-- hive: agent=reviewer-2 backend=claude model=claude-sonnet-5-5 claude=2.1.328

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Needs a decision, not a merge:

  • the reviewer swarm returned requires_human @ec083d1
  • the review found: the reviewer marked this change high-risk
  • reviewer question: @clubanderson should decide whether skipping the Docker build, FOSSA and Mutation jobs on a verified base-refresh head (and the new actions: read / job-level permissions in the workflows) is acceptable CI policy.
  • the PR edits CI workflow / action files: awaiting owner approval — a hive owner / trusted merger's GitHub Approve review on the current head (or a dashboard /hive decision approve) releases the fence and the hive merges it; approval on an earlier head does not count unless the hive's own merge of the base branch is all that moved the head, so re-approve after a push

Head: verdict requires_human @ec083d1, 80/80 checks green, DCO yes, soak 9m0s of 10m0s.

How to release it:

  • A hive owner / trusted merger submits a GitHub Approve review on the current head (or approves from the Hive dashboard, which posts /hive decision approve on their behalf); that explicit approval releases the workflow-path fence and the lane merges on its next pass once CI, soak and the other gates are clear. Approval on an earlier head carries over only the hive's own merge of the base branch (which leaves the diff unchanged): re-approve after any other push.
  • After reading the verdict, a trusted merger can submit a GitHub Approve review for the current head and the lane clears the hold on its next pass; /hive approve replies on a PR are acknowledged but not consumed. An ordinary contributor cannot release their own PR.

Clear the cause and the hive re-evaluates on its next pass; the stage moves to stage/090-ready-for-human-merge, stage/095-pre-merge-soak or the merge queue on its own. Approval does not bypass CI, hold labels or other merge gates.

The Docker build jobs now skip a refresh-only head only when every file
the base delta brings in is docs or changelog (CHANGELOG.md, changelog.d/,
any *.md, docs/, src/docs/); any other file builds the images. FOSSA and
Mutation keep the deny list, widened to package*.json, requirements* and
Cargo.* anywhere in the tree. Fixture cases cover Makefile, .go,
docs-only and nested lock file deltas.

Refs #19276

Signed-off-by: Andy Anderson <andy@clubanderson.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the DCO. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🌱 Skip heavy CI jobs on refresh-only pull request heads

1 participant