Repository navigation
feat(ci): reuse proven CI results (receipts, push skip, queue shadow) - #199
Merged
Merged
Conversation
scripts/ci-reuse.mbtx prints a verdict for a merge-queue or push run. A receipt is trusted only when the GitHub API confirms it: the PR head branch is in this repository, the newest ci.yml pull_request run of the current PR head succeeded, its one receipt artifact names the run, the PR head and this repository, and ci-ok succeeded in the latest attempt. Jobs that passed only in a re-run attempt are listed. A merge group with more than one commit, or a PR that changes CI policy, is not trusted. A push of a commit that a merge_group run proved is exact; an admin-bypass push of one commit from one merged PR uses that PR's receipt. Every failure is an untrusted verdict with the reason, and the script exits 0 for every verdict.
The ci-ok job writes the receipt through a mise task, so a PR that changes mise configuration (.config/mise/, .mise/, mise/, mise.toml and its variants) is a CI-policy PR and gets no reuse. The receipt's PR base must be a commit that Git places at or before this run's base, the receipt must come from the attempt in which ci-ok passed, and the queue ref must name the merge group's base. gh calls time out after 20 s with an API-error reason.
A re-run of a green run uploads ci-receipt-<sha> again in the same run. upload-artifact refuses a duplicate name, so ci-ok, the only required check, failed. Overwrite replaces the earlier receipt and keeps one per run.
A pull_request run tests a merge commit whose first parent is the base it tested; the payload base can differ from it. ci-gate reads the parent with git cat-file, which works in a depth-1 checkout, and records it as pr.base. The payload base is kept as pr.payloadBase only when it differs.
An exact push now needs a green merge_group run of ci.yml for every commit of before..sha on the first-parent line, not only for sha; the run of sha still supplies the receipt. A commit without one makes the verdict untrusted with the reason. Changes to .tool-versions, mise-tasks/, .mise-tasks/, scripts/moonbit-core.mbtx and tests/fixtures/core-pin/ are CI policy too: ci-ok's setup-moonbit runs the core pin script and its fixtures.
ci-changes now writes the notes of a ci-reuse child that exits 0 to the reuse log, not only the error of one that fails. The mise impact of the landed changes logs as "ci-changes: reuse: landed mise: ", so it is not mistaken for the run's own mise log. stdout and GITHUB_OUTPUT do not change. New tests pin that an exact verdict in a merge_group run does not skip, and that a receipt which proved code but not full re-runs full.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
github-merge-queue
Bot
removed this pull request from the merge queue due to no response for status checks
Oct 21, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to no response for status checks
Oct 21, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to no response for status checks
Oct 21, 2026
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.
Summary
CI no longer runs checks again when it has already proven them on the same code (beads
morphir-ukvn.5.90.1, planmorphir-ukvn.5.90.1.1, Tasks 1-6).ci-okpasses, it writes a JSON receipt (scripts/ci-gate.mbtx --receipt, mise taskci:gate:receipt). The receipt records the run, the tested commit and tree, the selection and the job results. For a pull request, it also records the head and the base that the run tested, which is the first parent of the merge commit. The workflow uploads the receipt asci-receipt-<sha>(30 days,overwrite: true).scripts/ci-reuse.mbtxfinds the receipt that covers a merge-queue run or a push run and checks it throughgh apiand git. It accepts no fork PRs and no PRs that change CI policy (workflows, actions,scripts/ci-, mise config, toolchain setup). The run must be the newest greenci.ymlrun for the PR's current head.ci-okmust be green in the receipt's attempt. The receipt base must be an ancestor of the current base. Eachghcall times out after 20 s. Any failure gives an untrusted verdict with a reason, and the run then selects as today.merge_grouprun runs only the always-run jobs (changes,lint,format-check,validate-config). These jobs still save thesetup-moonbittool caches that PR runs read.scripts/ci-changes.mbtxre-runs a check only when both the changes landed since the PR run and the PR's own changes select it. In this PR it only logs the decision on stderr (ci-changes: reuse: ...). Stdout andGITHUB_OUTPUTdo not change. Enforcement waits for five queued PRs whose shadow log matches the real result (morphir-ukvn.5.90.1.1.7).pull_requestnow runs for PRs into any base branch, so a stacked child gets CI.ci-gateandci-changesnow parse arguments withmoonbitlang/core/argparse.ci-changes --jsonprints the selection as one JSON object. Existing callers do not change.Replay (last 25 merged PRs)
morphir-ukvn.5.90.5. Bypass reuse stays in shadow mode.Test plan
moonx scripts/ci-gate.mbtx --self-test,moonx scripts/ci-reuse.mbtx --self-test,moonx scripts/ci-changes.mbtx --self-testmise run test:ci,mise run lint,mise run lint:moonbit,mise run validate,actionlintci-reusechecks against the live API for feat(cli): observe originals operations #192, build!: move to stock MoonBit 0.10.16 and retire the core override #193, feat(ci): select checks by semantic mise config changes (shadow mode) #194 and 5b710a2 (untrusted, because no receipts exist yet)setup-moonbitin PR runs before and after this change.