Skip to content

ci: skip the push-to-main checks a pull request proved, and add scripts/check --fast - #326

Merged
possiblyneal merged 5 commits into
mainfrom
possiblyneal/ci-dedupe
Nov 19, 2026
Merged

possiblyneal merged 5 commits into
mainfrom
possiblyneal/ci-dedupe

Conversation

@possiblyneal

@possiblyneal possiblyneal commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

Intent

No issue; from the Operator's request to stop running CI twice per change.

A clean merge ran ci.yml on the pull request and again on the push to main over the same tree, and every commit ran the full local gate, build included, before the pull request's CI built the same tree again. After this PR, on a self-hosted runner, the push-to-main run skips its checks (and stays green) when a passing pull request run recorded the exact tree that landed, and scripts/check --fast gives agents a commit-time gate that leaves build to CI.

Read first

  • scripts/ci-tested — the whole skip decision: one artifacts query for HEAD's tree, filtered to unexpired, same-repository runs
  • .github/workflows/ci.yml:42 — the step that calls it and the if: on the four check steps after it; ci.yml:93 — the two steps that record a passing pull request run's tree
  • scripts/check:24 — --fast and the argument loop; scripts/ci:11 — --no-build
  • Mechanical: every file under apps/github-repository-template/src/base-repo/ is a byte copy of its root twin (scripts/payload-parity)

Decisions

  • The pull request run records the tree it tested (an artifact named ci-tested-tree-<tree>) over the push inferring it from the head SHA and github.event.before, because review showed that inference wrong for a run against another base branch, a force-rewound main, and a green run beside a newer red one. A base that moved since the run gives a different tree, so it never skips.
  • A squash, rebase or fast-forward whose resulting tree matches skips too, since the tree is what was tested, not the commit.
  • Artifacts from a fork's run, or with no run, are ignored, since a pull request can rewrite the step that uploads them; a same-repository branch is trusted, as whoever pushes one can push to main.
  • Skip and record only where vars.RUNNER is set, because on a hosted runner a skipped push stops main saving the Go, uv and Gradle caches every pull request restores, and there the second run uses the plan's hosted minutes rather than the Operator's machine. Hosted repositories, the default, keep the double run.
  • Skipped steps leave the job green over failing it or omitting the job, so a required ci status on main still resolves.
  • --fast drops only build. Across 2,086 gate runs in the transcripts (Sep 26 to Nov 18), build was the only failing step 8 times, none a defect in the commit, while it cost about 9.4 hours of waiting.
  • scripts/ci --no-build keeps the capability list in one file over scripts/check assembling its own.

Out of scope

  • Moving the ship skill to scripts/check --fast; that is devex's apps/claude-user-level and lands in its own PR.
  • Shortening the land-time verify, which still runs the full gate.

Verified

  • scripts/tests/ci-tested-test → 6 passed (a recorded tree skips and queries HEAD's tree, no record, expired record, fork's record, record with no run, failed query); the gh stub runs the script's own --jq filter through jq
  • scripts/tests/check-test → 14 passed (after merging main); scripts/tests/capabilities-test → 83 passed
  • scripts/payload-parity → pass
  • scripts/check → exited 0: 0 FAIL, 0 unavailable, 5 not-applicable, 26 pass
  • gh api 'repos/actions/toolkit/actions/artifacts?per_page=1' → an artifact carries expired and workflow_run.{repository_id,head_repository_id}, the fields the filter reads
  • actions/upload-artifact latest is v7.0.2 (2026-10-07), so @v7 matches the repository's actions/*@v7 style

Not verified

  • Neither step has run on GitHub: this repository sets no RUNNER variable, so its own CI stays hosted and never reaches them. The first self-hosted repository on the updated payload is the live test; its push log carries ci-tested:'s reason line.
  • That GET /actions/artifacts?name= matches the name exactly is from the API's documented behaviour, not observed here.

Merge danger

Door: two-way: a revert restores the double run and the full-only gate.

Blast radius: every repository's ci.yml and scripts/check once a /repo-builder template update carries the payload; this repository's own main checks on the next push.

neal added 4 commits November 18, 2026 22:52
Every change ran the whole gate at commit time and again in the pull
request's CI, on the same self-hosted machine, so the build step ran
twice for one tree. Across 2,086 gate runs in the agent transcripts from
Sep 26 to Nov 18, build was the only failing step 8 times, and none of
those was a defect in the change being committed: all were a known
failure already on main or a worktree missing its node_modules. The
step cost about 9.4 hours of waiting over those 53 days, mostly devex
(61s) and glydr (40s).

--fast runs everything else and passes --no-build to scripts/ci, the one
place the capability list lives. The full gate stays the default, so CI
and the land-time verify still build before anything reaches main.

Generated-By: claude-opus-5-5
…hat tree

A clean merge ran ci.yml twice on one tree: once on the pull request
and again on the push to main, spending self-hosted runner CPU for no
new signal.

scripts/ci-tested decides the skip with the test /land already uses for
its local gate: the replaced tip is an ancestor of the landed head (the
merge commit's second parent, or HEAD on a fast-forward) and HEAD's tree
is that head's, then GitHub must report a passing pull_request run of
this workflow on that head. The query goes by head_sha because runs
created by a push carry no pull_requests field. A squash or rebase merge
writes a commit no pull request run saw, a moved base fails the ancestor
test, and any failed lookup answers skip=false, so every doubt runs the
checks; a wrong skip leaves main unproven, a wrong run costs minutes.

The job still succeeds when it skips, so a required status on main
stays green. It needs actions: read for the runs query.

Generated-By: claude-opus-5-5
The skip trusted a passing pull request run on the landed head's SHA, with
the base reasoned forward from github.event.before. Review found that it
trusted too much: a run against another base branch, a force-rewound main,
or an older green run beside a newer red one could each skip a tree no run
had proved.

A passing pull request run now uploads an artifact named for the tree it
tested, its merge ref's, and the push skips only when an unexpired one from
a same-repository run names HEAD's tree. That drops the ancestry reasoning,
and a squash or fast-forward whose tree matches now skips too.

Both steps run only where vars.RUNNER is set. A hosted runner costs the
operator nothing for the second run, and skipping it there would stop main
saving the Go, uv and Gradle caches each pull request restores.

Generated-By: claude-opus-5-5
The API allows an artifact's workflow_run to be null, and then the fork
filter compared null with null and counted it as a same-repository pass.
It now requires a repository id, so an artifact of unknown origin answers
skip=false like every other doubt.

The header also says what the artifact name does not prove: a branch in this
repository can upload one without running the checks. That is trusted
because whoever can push such a branch can already push to the default
branch.

The previous commit said a hosted runner costs the operator nothing for the
second run. On a private repository it uses the plan's minutes; hosted runs
keep the double run to keep main's caches warm.

Generated-By: claude-opus-5-5
@possiblyneal possiblyneal added the code-reviewed Multi-axis code review passed label Nov 19, 2026
@possiblyneal

Copy link
Copy Markdown
Owner Author

Code review: standard scan, clean.

Axes: Standards+Spec, Correctness/Logic

Reviewed-Head: 0d40461

@possiblyneal

Copy link
Copy Markdown
Owner Author

Code review: standard scan, clean.

Axes: Standards+Spec, Correctness/Logic

Reviewed-Head: 3e3db28

@possiblyneal
possiblyneal merged commit 282d60e into main Nov 19, 2026
7 checks passed
@possiblyneal
possiblyneal deleted the possiblyneal/ci-dedupe branch November 19, 2026 04:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code-reviewed Multi-axis code review passed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant