Skip to the content.

0008: A compute receipt from a CI runner (GitHub Actions first)

Status: implemented. Author: Claude, the lean-pkg operations agent, drafting for Le Chen. Created: 2026-10-26. Decided: accepted 2026-10-26 by Le Chen, with the recommended answers to open questions 1 to 11. Implemented in: 0.22.0 (doi:10.5281/zenodo.23719839), by #338 (S1, level 1), #348 (S2, receipt ci and verify.yml), #355 (S3, --corroborate, level 2), #363 (S4, --attested, level 3) and #358 (S5, the comparator tier in CI), with #364, #374, #375, #379 and #382; validated by a live run in chenle02/neumann-cosine-lean (run 40501641370, levels 1 to 3). Tracked in #318.

Summary

A package author with a public GitHub repository and no cluster account gets a lower-tier receipt from a GitHub Actions run that backs coverage.yaml compute the way slurm-<J> does today, and that a third party can corroborate without trusting the author. The receipt is an ordinary lower-receipt/1 receipt with job_id: gha-<run_id>-<run_attempt> and an additive ci block. A new scheduler github-actions and a built-in site profile of the same name read it. Three corroboration levels are defined: offline consistency (level 1, as strong as a Slurm receipt and as forgeable), the public run API (level 2, --corroborate) and a Sigstore attestation (level 3, --attested). The page’s GitHub Actions sentence renders only at level 2 or 3, and levels 2 and 3 require lean-pkg’s pinned reusable verify.yml. New commands: lean-pkg receipt ci (the writer, in the job), receipt ci --collect RUN and receipt ci --template. This proposal turns section 4 of the sites and CI receipts design note into a decision; no code changes until it is accepted.

Motivation

Design

This proposal builds on the lower-receipt/1 marker and the event-line v key of pull request #324 (on-disk formats). The ci block is an additive key within lower-receipt/1, under the additive-change rule stated there.

Scheduler and job id

The ci block

The receipt keeps its nine fields (commit, lean_toolchain, mathlib_rev, sorry_count, axioms, report_sha256, job_id, checker, generated_at; RECEIPT_FIELDS, src/lean_pkg/cli.py:255), so gate validates it unchanged, and gains one additive key ci, a mapping. Every value comes from a variable the runner sets, never from the workflow author’s input. Required keys and values are strict; unknown keys inside ci are ignored, as for producer (open question 7).

Key Type Required Source Checked
provider string yes constant level 1: equals github-actions
server_url string yes GITHUB_SERVER_URL level 1: equals https://github.com (open question 11)
repository string OWNER/REPO yes GITHUB_REPOSITORY level 1: well formed, and the OWNER/REPO prefix of workflow_ref; level 2: the API path it is fetched from (a renamed repository redirects; identity is the id)
repository_id integer > 0 yes GITHUB_REPOSITORY_ID level 2: equals the run’s repository.id and the package’s own repository id (open question 6)
run_id integer > 0 yes GITHUB_RUN_ID level 1: job_id == gha-<run_id>-<run_attempt>; level 2: the API run
run_attempt integer >= 1 yes GITHUB_RUN_ATTEMPT as run_id; level 2 reads that attempt, never the latest
job string yes GITHUB_JOB shown; not load-bearing (the job is identified by its annotation, below)
event string yes GITHUB_EVENT_NAME level 1: push or workflow_dispatch (open question 5); level 2: equals the run’s event
head_sha 40 lowercase hex yes GITHUB_SHA level 1: equals commit; level 2: equals the run’s head_sha
workflow_ref string OWNER/REPO/PATH@REF yes GITHUB_WORKFLOW_REF level 1: PATH under .github/workflows/; level 2: PATH equals the run’s path
workflow_sha 40 lowercase hex yes GITHUB_WORKFLOW_SHA the commit the workflow file is read at
workflow_file_sha256 64 lowercase hex yes SHA-256 of the workflow file at workflow_sha level 1: rehashed when workflow_sha is in the clone, else a shown skip; level 2: rehashed from the API
job_workflow string OWNER/REPO/PATH@REF, or null yes the OIDC token’s job_workflow_ref claim (open question 10) level 1: well formed when not null; level 2: not null, equals lean-pkg/lean-pkg/.github/workflows/verify.yml@<40-hex>, pinned (below)
runner mapping yes RUNNER_ENVIRONMENT, RUNNER_OS, RUNNER_ARCH, ImageOS, ImageVersion level 1: environment equals github-hosted (else refused, naming receipt local); os, arch strings; image, image_version string or null; level 2: the job ran in the hosted runner group
verify_log_sha256 64 lowercase hex yes SHA-256 of the redacted verify log level 1: equals report_sha256, and the committed log hashes to it
attestation string (a file name, no /) no written by receipt ci when the job attests level 3: the Sigstore bundle committed beside the receipt under .lean-receipts/

job_workflow is null when the job has no id-token: write permission (any workflow but lean-pkg’s own may lack it): level 1 accepts that, level 2 refuses it. The OIDC token is read in the job to take the one claim and is never written anywhere.

Example (abridged):

{
  "schema": "lower-receipt/1",
  "commit": "4f1c...e2a0",
  "job_id": "gha-11622958301-1",
  "report_sha256": "9b3e...51c4",
  "ci": {
    "provider": "github-actions",
    "server_url": "https://github.com",
    "repository": "alice/demo-lean",
    "repository_id": 812345678,
    "run_id": 11622958301,
    "run_attempt": 1,
    "job": "verify",
    "event": "push",
    "head_sha": "4f1c...e2a0",
    "workflow_ref": "alice/demo-lean/.github/workflows/lean-pkg.yml@refs/heads/main",
    "workflow_sha": "4f1c...e2a0",
    "workflow_file_sha256": "0d7a...93be",
    "job_workflow": "lean-pkg/lean-pkg/.github/workflows/verify.yml@6c2d...71f9",
    "runner": {"environment": "github-hosted", "os": "Linux", "arch": "X64",
               "image": "ubuntu24", "image_version": "20261020.1.0"},
    "verify_log_sha256": "9b3e...51c4",
    "attestation": "4f1c2d3e4a5b-gha-11622958301-1.sigstore.json"
  }
}

The files follow the existing naming: .lean-receipts/<c12>-gha-<R>-<A>.json and <c12>-gha-<R>-<A>-verify.redacted.log (cli.receipt_job_slug keeps the id as it is).

A receipt with job_id of the gha- spelling and no ci block still passes gate (it is a lower-tier receipt like any other) but backs no compute job, as a bare job number backs no Slurm job today.

The three corroboration levels

Each level reports what it proved; the level a receipt reached is computed at check time and never stored (no committed corroboration record, see Alternatives). Level 3 proves everything level 2 proves about the run’s identity, through the signed certificate instead of the API, so it holds after the run’s records expire; the API checks of level 2 also run under --attested --corroborate while the run is retained.

Level How Checks Proves Does not prove
1, offline (the default of gate, coverage check, page, receipt check) no network the nine fields bind (validate_receipt); the committed redacted log hashes to report_sha256; ci keys and values as in the table; verify_log_sha256 == report_sha256; head_sha == commit; job_id == gha-<run_id>-<run_attempt>; hosted runner; server_url; allowed event; the workflow file at workflow_sha hashes to workflow_file_sha256 when that commit is in the clone (else a shown skip) the receipt is consistent with itself, the commit and the committed log: the same strength as slurm-<J> (design note, section 4.6) that any run happened: every GITHUB_* value is text the author could write
2, corroborated (--corroborate) the public REST API, unauthenticated for a public repository, a token optional GET /repos/{repository}/actions/runs/{run_id}/attempts/{run_attempt}: status: completed, conclusion: success, head_sha == commit, path equals the workflow path, event equals ci.event, repository.id == ci.repository_id and equals the package’s repository id; the attempt’s jobs: the job whose check run carries the receipt annotation (below) has conclusion success and ran in the hosted runner group; the workflow file at workflow_sha hashes to workflow_file_sha256 and calls lean-pkg/lean-pkg/.github/workflows/verify.yml@<40-hex>, whose content is in the shipped pin list and whose ref equals job_workflow; exactly one lean-pkg-receipt annotation, whose two hashes equal the committed receipt and log a real, successful run of lean-pkg’s pinned verify workflow, in that repository (by numeric id), on that commit, on a GitHub-hosted runner, which wrote exactly the committed receipt and log bytes anything once the run is deleted or its records expire; that build code in the same job did not lie (Trust model)
3, attested (--attested) gh attestation verify, an optional outside tool, as sacct is the committed bundle verifies: gh attestation verify FILE --bundle B --repo OWNER/REPO --signer-workflow lean-pkg/lean-pkg/.github/workflows/verify.yml --deny-self-hosted-runners, or offline with --custom-trusted-root; its subjects are exactly the receipt and the redacted log digests; the certificate’s repository, source commit and run equal the ci block the same run identity as level 2 plus a signature from GitHub’s OIDC token recorded in the public transparency log, which survives log expiry the mathematics; that build code in the same job did not lie

Every failure at levels 2 and 3 fails closed and is named: an HTTP 404 (the run deleted or never there), 403 or 429 (rate limit, naming GH_TOKEN), a network error, an expired run, a redirect off api.github.com. None is ever reported as a pass, and none lowers a receipt below level 1.

The pinned reusable workflow and how “pinned” is decided

The receipt-bytes binding annotation

The API shows that a run succeeded, not that the committed files are the ones it wrote. receipt ci therefore emits exactly one workflow notice,

::notice title=lean-pkg-receipt::receipt_sha256=<64 hex> report_sha256=<64 hex>

and level 2 reads the job’s check-run annotations and requires exactly one with that title, both hashes equal to the committed receipt bytes and the committed redacted log. A second annotation of that title (build code imitating it) refuses the receipt. receipt ci writes deterministic bytes and --collect copies them unchanged, so an edited receipt (a key added after download) no longer corroborates.

Allowed events and repository identity

Commands

The built-in site profile and the sentence rule

Backing compute

compute: [{cluster: github-actions, jobs: [gha-<run>-<attempt>]}], each job the job_id of a receipt of the github-actions scheduler committed at HEAD with a valid ci block (level 1). The scheduler’s reader is a second entry in coverage.JOB_INDEX (coverage.py:517); the near-miss hint for a listed job without a receipt, Slurm-only today (coverage.py:535 to 544), becomes per scheduler (for GitHub Actions: a gha- receipt without a ci block, or one whose block fails, is named with the reason; a slurm- id under github-actions and the reverse are refused).

The comparator tier in CI

comparator-receipt recognizes a third context in host_policy_ok (src/lean_pkg/comparator_receipt.py:452): GITHUB_ACTIONS=true and RUNNER_ENVIRONMENT=github-hosted. It records host_policy: "GitHub Actions run R attempt A", job_id: gha-R-A (instead of SLURM_JOB_ID or local-..., line 2193) and the same ci block. A comparator receipt backs a github-actions job only with a valid ci block: the CI counterpart of slurm_job_of’s sealed-sacct rule (coverage.py:450). GITHUB_ACTIONS without RUNNER_ENVIRONMENT, or on a self-hosted runner, is not recognized. The judge needs an unprivileged user namespace for bwrap, which current Ubuntu runner images restrict through AppArmor: verify.yml’s comparator job runs lean-pkg comparator host-check --routes first and lifts the restriction with sudo sysctl (hosted runners allow it), or fails with the route named.

Implementation plan

Stacked pull requests, each green on its own, each with its upgrade-record entry (docs/upgrades/<next>.yaml) and design-note status line; the last sets this proposal implemented and plan row 9a done.

Stage Content Upgrade record
S0 this proposal and its README row no_author_change
S1 the scheduler and sentence_level, the built-in profile, level 1 in validate_receipt (beside the slurm_sacct block, cli.py:2859) and receipt check, the JOB_INDEX reader and per-scheduler near-misses, page --json level/levels, the legacy-key narrowing, the ci block in docs/formats.md and LLMS_TEXT kind: format, not breaking
S2 receipt ci, --collect, --template, verify.yml, the built-in redactions kind: command
S3 --corroborate (receipt check, page, publish --dry-run), the pin list, the annotation, the sentence at level 2 and above kind: command
S4 the attestation step, the committed bundle, --attested, level 3 kind: command
S5 the comparator tier in CI kind: format, not breaking

Compatibility and migration

Trust model

Yes: this adds a scheduler that backs compute, a sentence on the page, and refusals in gate, coverage check, page and receipt check.

Tests that pin every refusal, by stage:

Alternatives

Open questions

The maintainer agreed the recommended answer to each question in the design discussion of 2026-10-26 (issue #318); the proposal itself still needs acceptance.

  1. Write this proposal before any code? Recommendation: yes; decision 0007 (lines 127 to 130) requires it, and proposal 0005 is the precedent. (maintainer: take the recommendation, 2026-10-26)
  2. How does the verbatim acknowledgement of site-profile/1 name the run? Recommendation: a {runs} token, allowed only where the scheduler’s sentence_level > 1 (built-in only), filled with run links. Alternative: a static sentence and a separate evidence line. (maintainer: take the recommendation, 2026-10-26)
  3. Bind the committed bytes at level 2? Recommendation: yes, exactly one lean-pkg-receipt notice annotation with receipt_sha256 and report_sha256, required to match. (maintainer: take the recommendation, 2026-10-26)
  4. What makes verify.yml “pinned”? Recommendation: its content SHA-256 is in the list shipped with lean-pkg, and the caller names it by a 40-hex commit SHA. (maintainer: take the recommendation, 2026-10-26)
  5. Allowed events? Recommendation: push and workflow_dispatch only. (maintainer: take the recommendation, 2026-10-26)
  6. Repository identity? Recommendation: level 2 requires the package’s own repository id (from the registry’s repository URL in page; --github OWNER/REPO in receipt check, the receipt’s own repository printed when absent); fork runs do not back. (maintainer: take the recommendation, 2026-10-26)
  7. How strict is the ci block? Recommendation: required keys and values strict, unknown keys ignored, like producer. (maintainer: take the recommendation, 2026-10-26)
  8. Offline page --check on a README carrying the GitHub Actions sentence? Recommendation: fail closed with a --corroborate hint; CI passes --corroborate with its token. Alternative: a WARN, which would stay green after the run expires. (maintainer: take the recommendation, 2026-10-26)
  9. Level 3 tooling? Recommendation: gh attestation verify as an optional outside tool; no Sigstore dependency. (maintainer: take the recommendation, 2026-10-26)
  10. Where does job_workflow come from? Recommendation: the OIDC token’s job_workflow_ref claim, read in the job (id-token: write), the token never written; S2 checks whether a context expression gives the same value without the token. (maintainer: take the recommendation, 2026-10-26)
  11. GitHub Enterprise Server? Recommendation: refused in v1; server_url must be https://github.com. (maintainer: take the recommendation, 2026-10-26)

AI assistance

Drafted by Claude (Anthropic), the lean-pkg operations agent, from section 4 of the design note, a read-only implementation plan written by a Claude planning subagent, and the maintainer’s settled summary on issue #318; the code anchors were checked against the base commit. To be reviewed and decided by the maintainer.