Repository navigation
ci: skip the push-to-main checks a pull request proved, and add scripts/check --fast - #326
Merged
Merged
Conversation
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
Owner
Author
|
Code review: standard scan, clean. Axes: Standards+Spec, Correctness/Logic Reviewed-Head: 0d40461 |
Generated-By: claude-opus-5-5
Owner
Author
|
Code review: standard scan, clean. Axes: Standards+Spec, Correctness/Logic Reviewed-Head: 3e3db28 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
No issue; from the Operator's request to stop running CI twice per change.
A clean merge ran
ci.ymlon the pull request and again on the push tomainover 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-mainrun skips its checks (and stays green) when a passing pull request run recorded the exact tree that landed, andscripts/check --fastgives agents a commit-time gate that leavesbuildto 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 theif:on the four check steps after it;ci.yml:93— the two steps that record a passing pull request run's treescripts/check:24—--fastand the argument loop;scripts/ci:11—--no-buildapps/github-repository-template/src/base-repo/is a byte copy of its root twin (scripts/payload-parity)Decisions
ci-tested-tree-<tree>) over the push inferring it from the head SHA andgithub.event.before, because review showed that inference wrong for a run against another base branch, a force-rewoundmain, and a green run beside a newer red one. A base that moved since the run gives a different tree, so it never skips.main.vars.RUNNERis set, because on a hosted runner a skipped push stopsmainsaving 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.cistatus onmainstill resolves.--fastdrops onlybuild. 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-buildkeeps the capability list in one file overscripts/checkassembling its own.Out of scope
scripts/check --fast; that is devex'sapps/claude-user-leveland lands in its own PR.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); theghstub runs the script's own--jqfilter throughjqscripts/tests/check-test→ 14 passed (after mergingmain);scripts/tests/capabilities-test→ 83 passedscripts/payload-parity→ passscripts/check→exited 0: 0 FAIL, 0 unavailable, 5 not-applicable, 26 passgh api 'repos/actions/toolkit/actions/artifacts?per_page=1'→ an artifact carriesexpiredandworkflow_run.{repository_id,head_repository_id}, the fields the filter readsactions/upload-artifactlatest is v7.0.2 (2026-10-07), so@v7matches the repository'sactions/*@v7styleNot verified
RUNNERvariable, 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 carriesci-tested:'s reason line.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.ymlandscripts/checkonce a/repo-buildertemplate update carries the payload; this repository's ownmainchecks on the next push.