Skip to content

ci: GitHub-hosted + self-hosted runners (fastest wins), term-guard via curl/jq, image smoke RC-only - #430

Closed
jencryzthers wants to merge 9 commits into
mainfrom
ci/no-github-hosted-main
Closed

jencryzthers wants to merge 9 commits into
mainfrom
ci/no-github-hosted-main

Conversation

@jencryzthers

@jencryzthers jencryzthers commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Policy: no job runs on a GitHub-hosted runner. This moves all 39 hosted jobs on main to self-hosted labels and adds a guard so none come back.

Guard

  • scripts/check-runner-labels.mjs scans .github/workflows/*.yml and fails on any runs-on that uses ubuntu-*, windows-*, macos-*, *-latest, a matrix/expression resolving to those, or that lacks self-hosted.
  • .github/workflows/runner-guard.yml runs it on [self-hosted, linux, x64] for PRs touching workflows, pushes to main and the merge queue. It passes on this branch.

Label sets

  • Linux: [self-hosted, linux, x64]
  • Linux needing sudo/apt/AppArmor/dpkg: [self-hosted, linux, x64, ephrunner.vm-sudo]
  • macOS / iOS: [self-hosted, macOS, ARM64, ephrunner.mac]
  • Windows: [self-hosted, windows, x64, ephrunner.vm-windows]
  • Linux ARM64 (unmapped, see below): [self-hosted, linux, ARM64]

Jobs on ephrunner.vm-sudo, ephrunner.mac, ephrunner.vm-windows and ARM64 stay queued until those runners exist. That is accepted.

Jobs moved

ci.yml

  • static, behavior-evals, voice-acceptance, gate (CI), foss, control-plane, deploy-composio-broker, android -> Linux
  • vitest, packaged-server: matrix keys are now linux / windows / macos, mapped in runs-on to the label sets above
  • ui-smoke (renderer smoke), package-linux -> Linux vm-sudo
  • windows-cua -> Windows; electron-smokes, ios -> macOS
  • cloudflared-linux-arm64 -> Linux ARM64

release.yml: prepare, ci, assemble -> Linux; linux -> Linux vm-sudo; mac -> macOS; windows -> Windows (all only run from the release workflow, push of package.json on main or dispatch, unchanged)

Other workflows

  • ci-stop-closed, contributors, docker (build-and-smoke, publish), docs, image gate, npm-package (3 jobs), prepare-release, sandbox-image, sync-published-release -> Linux
  • package-linux, voice-release-acceptance, browser-vendor-windows build -> Linux vm-sudo
  • browser-vendor-windows smoke, package-win, shared-terminal-smoke -> Windows
  • ios-thread-ui -> macOS
  • codeql analyze-swift: was already self-hosted macOS; relabeled to the macOS set above

Gating changes (Windows/macOS only on release or manual dispatch)

  • scripts/ci-scope.mjs: platforms=true and the Linux+Windows+macOS vitest matrix only for workflow_dispatch. Pull requests, main pushes and merge groups now run Linux only, and windows-cua, electron-smokes, ios and the Windows packaged-server leg are skipped (the CI gate already accepts them skipped when platforms=false).
  • ios-thread-ui.yml: removed the nightly schedule and the push trigger; workflow_dispatch only.
  • browser-vendor-windows smoke: if: github.event_name == 'workflow_dispatch' (the PR-triggered Linux build still runs).
  • codeql analyze-swift: if: github.event_name == 'workflow_dispatch' (was every non-PR event).
  • cloudflared-linux-arm64: workflow_dispatch only, so PRs don't wait on an ARM64 runner that doesn't exist.
  • package-win, shared-terminal-smoke were already dispatch-only. release.yml mac/windows unchanged (release only).

Unmapped / notes

  • cloudflared-linux-arm64 asserts process.arch == "arm64", so it needs a real ARM64 Linux runner; there is no such label yet. It is labeled [self-hosted, linux, ARM64] and gated to manual runs.
  • Tests updated: scripts/ci-scope.test.ts, scripts/ci-workflow.test.ts (new matrix keys, gating and labels); scripts/testing/update-shard-weights.mjs reads vitest (windows, shard N/4) job names.

Repository guard

  • Every job's if: starts with (!startsWith(github.event_name, 'pull_request') || github.event.pull_request.head.repo.full_name == github.repository) && (github.event_name != 'workflow_run' || github.event.workflow_run.head_repository.full_name == github.repository). The first clause covers pull_request and pull_request_target (head repository must be this one); the second covers workflow_run (the triggering run's head repository must be this one).
  • Workflows on comment triggers also require github.event.comment.author_association in OWNER/MEMBER/COLLABORATOR.
  • Event text (titles, branch names, bodies, messages) reaches scripts only through env:, never ${{ }} inside run:.
  • pull_request_target / workflow_run workflows never check out the pull request head and never persist checkout credentials.
  • scripts/check-runner-labels.mjs enforces all of the above plus self-hosted labels; scripts/check-runner-labels.test.mjs runs it against fixtures in scripts/testing/runner-guard-fixtures/. runner-guard.yml runs both.
  • Effect: jobs triggered by pull requests from other repositories, or by workflow_run for runs whose head is in another repository, are skipped, including term-guard and the CLA check.
  • Fork PR approval policy (read-only check): all_external_contributors.

CodeQL

Advanced setup in .github/workflows/codeql.yml: javascript-typescript, actions and python on [self-hosted, linux, x64]; swift on [self-hosted, macOS, ARM64, ephrunner.mac], manual only. Both guarded. Results upload unless the repository variable CODEQL_ADVANCED_UPLOAD is false; default setup must be turned off in repository settings for uploads to be accepted (not changed here).

Preuve

$ node scripts/check-runner-labels.mjs
runner guard: every job is self-hosted and repository-guarded      (exit 0)

$ node --test scripts/check-runner-labels.test.mjs
# tests 11  # pass 11  # fail 0

Negative fixtures (each exits 1 with the expected message):

fixture message
hosted GitHub-hosted label(s) ubuntu-latest
hosted-matrix runs-on resolves through a matrix/expression without self-hosted
no-repo-guard job a lacks the leading repository guard
prt-no-guard (pull_request_target) job a lacks the leading repository guard
prt-head-checkout pull_request_target/workflow_run must not check out pull request code
comment-no-actor (issue_comment) runs on a comment trigger without the actor guard
run-interpolation (${{ github.event.pull_request.title }} in run:) run: expands event text with ${{ }}; pass it through env: and quote it
workflow-run-no-head-repo (workflow_run, no head repository check) job a lacks the leading repository guard

Positive fixtures exit 0: good (pull_request_target + issue_comment, guarded, title via env) and workflow-run-good (workflow_run with the head repository check).

$ node@24 vitest run scripts/ci-scope.test.ts scripts/ci-workflow.test.ts scripts/release-ci.test.ts
Test Files  3 passed (3)
Tests  118 passed (118)

All workflow and fixture files parse as YAML.

jencryzthers and others added 7 commits October 13, 2026 14:03
…equests

Self-hosted runners have no gh CLI. term-guard fetches the pull request
diff and up to three pages of commits with curl and jq, using
GITHUB_TOKEN, and fails if either tool is missing.

The image build and boot smoke is a full-suite check. Pull requests no
longer start it. It runs on release candidate branches, version tags,
manual dispatch, and main when an image input changes.

Co-authored-by: Jean-Christophe Proulx <j.christophe@devjc.net>
…date

Jobs may use a self-hosted runner or a GitHub-hosted label. ubuntu-latest
is the Linux default for term-guard, the image boot smoke, and the runner
guard. The label check no longer fails on ubuntu-latest.

The image build stays off pull requests. It runs on release candidate
branches, version tags, and manual dispatch.

Co-authored-by: Jean-Christophe Proulx <j.christophe@devjc.net>
@jencryzthers jencryzthers changed the title ci: self-hosted runners only, fork guard ci: GitHub-hosted + self-hosted runners (fastest wins), term-guard via curl/jq, image smoke RC-only Oct 13, 2026
cursoragent and others added 2 commits October 13, 2026 22:42
Linux jobs waiting on self-hosted runners, including jobs that need sudo, now use ubuntu-latest. Windows and macOS jobs keep their self-hosted labels. Repository guards are unchanged.

Co-authored-by: Jean-Christophe Proulx <j.christophe@devjc.net>
Linux and sudo jobs use ubuntu-latest, Windows windows-latest, macOS and iOS macos-latest, and Linux ARM64 ubuntu-24.04-arm. CodeQL swift uses macos-latest. The runner guard fails on any self-hosted label. Repository guards stay.

Co-authored-by: Jean-Christophe Proulx <j.christophe@devjc.net>
@cursor

cursor Bot commented Oct 13, 2026

Copy link
Copy Markdown

Superseded. This pull request stays open and is not merged.

The same work is split into smaller pull requests off main:

Not split out of this pull request:

  • The CLA workflow change on this branch is the fork guard around the existing check. The fork guard is left for the other pull request, so there is no separate CLA pull request.
  • term-guard (curl/jq) is left for that other pull request.
  • The image build and boot smoke staying off pull requests is left out.

@cursor

cursor Bot commented Oct 13, 2026

Copy link
Copy Markdown

Closing this draft. Cryptic confirmed the split, and the small pull requests that replace it are open:

  1. ci: GitHub-hosted runners, and a guard that rejects self-hosted #440 — every job on a GitHub-hosted runner (ubuntu-latest, windows-latest, macos-latest, ubuntu-24.04-arm), plus the guard that rejects self-hosted.
  2. ci: CodeQL on ubuntu-latest, upload only when CODEQL_ADVANCED_UPLOAD is true #441 — CodeQL advanced setup on ubuntu-latest. Default setup stays on. Upload only when vars.CODEQL_ADVANCED_UPLOAD == 'true'. No Swift job.
  3. ci: run Windows and macOS jobs only on manual dispatch #442 — Windows and macOS jobs run only on manual dispatch.

Term-guard (curl + jq, GitHub-hosted) is #439, opened separately. The CLA workflow change on this branch was only the fork guard, so there is no CLA pull request. The release-candidate-only image smoke change is not part of this split.

cursor Bot pushed a commit that referenced this pull request Oct 14, 2026
Keep #430 repository guards, GitHub-hosted runners, and image smoke off
pull requests. Take main's Windows Vitest/Electron/voice-bench fixes,
CRLF runner-guard reads, hosted-label allowlist, CodeQL upload-only-when-true,
and the hardened term-guard curl fetch.

Co-authored-by: Jean-Christophe Proulx <j.christophe@devjc.net>
@cursor

cursor Bot commented Oct 14, 2026

Copy link
Copy Markdown

Fusion de origin/main dans ci/no-github-hosted-main (commit de merge 450d0f0f0131795f89454439ee68f4f740b5ae72). Pas de rebase, pas de force-push. La PR reste fermée : GitHub garde encore l’ancien head 084d140c sur cette PR, donc les checks pull_request n’ont pas redémarré sur le merge.

Intention gardée de #430 : runners GitHub-hosted, garde de dépôt sur chaque job, smoke image hors des pull requests, term-guard en curl/jq. Correctifs de main (#438 et la suite) : tests Windows (Local VM, plugins, banc vocal, Electron), lecture CRLF du runner-guard, allowlist d’images hosted, CodeQL sans job Swift et upload seulement si CODEQL_ADVANCED_UPLOAD est true.

Fichiers en conflit et résolution

Fichier Résolution
.github/workflows/browser-vendor-windows.yml Garde de dépôt de #430 autour de workflow_dispatch pour le smoke Windows
.github/workflows/ci.yml Gardes de dépôt de #430 sur windows-cua, electron-smokes et ios ; libellé « manual dispatch » de main
.github/workflows/codeql.yml Politique de main (pas de Swift, default setup, upload seulement si vrai) + garde de dépôt de #430
.github/workflows/ios-thread-ui.yml Commentaire de #430 (suite iOS au dispatch) ; workflow_dispatch seulement, déjà sur les deux côtés
.github/workflows/release.yml Gardes de dépôt de #430 autour de should_release
.github/workflows/runner-guard.yml Garde de dépôt de #430 + invocation de main (node scripts/check-runner-labels.mjs .github/workflows)
.github/workflows/sync-published-release.yml Garde de dépôt de #430 autour de la condition de publication
.github/workflows/term-guard.yml Fetch durci de main (curl/jq, coordonnées validées, 30 pages) + garde de dépôt de #430
docs/security/term-guard.md Texte de main + note curl/jq de #430
scripts/check-runner-labels.mjs Contrôles fork/acteur/run: de #430 + allowlist hosted et split(/\r?\n/) de main
scripts/check-runner-labels.test.mjs Vitest et cas CRLF de main + fixtures de garde de #430
scripts/ci-scope.mjs Clés de matrice linux / macos / windows de #430 (ci.yml les mappe vers les images hosted)
scripts/testing/runner-guard-fixtures/hosted/w.yml Garde de dépôt de #430
scripts/testing/runner-guard-fixtures/hosted-matrix/w.yml Garde de #430 + liste d’OS élargie de main
scripts/testing/runner-guard-fixtures/self-hosted/w.yml Garde de dépôt de #430
scripts/testing/runner-guard-fixtures/unknown-runner/w.yml Garde de dépôt de #430

foo-latest (ajouté sur main) a reçu la même garde, pour que le cas ne échoue que sur le libellé.

Les tests produit Windows de #438 (Electron, Local VM, voice-bench, plugins) sont entrés sans conflit.

Preuve

$ node scripts/check-runner-labels.mjs .github/workflows
runner guard: every job uses a GitHub-hosted runner and is repository-guarded      (exit 0)

$ python3 scripts/ci/term-guard.test.py
Ran 11 tests in 0.269s
OK

$ pnpm exec vitest run scripts/check-runner-labels.test.mjs scripts/ci-scope.test.ts scripts/ci-workflow.test.ts scripts/release-ci.test.ts
Test Files  4 passed (4)
Tests  133 passed (133)

Fixtures négatives (chacune exit 1, message attendu) :

fixture message
self-hosted runs-on uses a self-hosted label
unknown-runner runs-on is not a GitHub-hosted label
foo-latest runs-on is not a GitHub-hosted label
no-repo-guard job a lacks the leading repository guard
prt-no-guard (pull_request_target) job a lacks the leading repository guard
prt-head-checkout pull_request_target/workflow_run must not check out pull request code
comment-no-actor (issue_comment) runs on a comment trigger without the actor guard
run-interpolation (${{ github.event.pull_request.title }} dans run:) run: expands event text with ${{ }}; pass it through env: and quote it
workflow-run-no-head-repo (workflow_run, sans check du head repository) job a lacks the leading repository guard

Fixtures positives exit 0 : good, workflow-run-good, hosted, hosted-matrix. Tous les YAML de workflows et de fixtures parsent.

Le banc vocal synthétique scripts/voice-benchmark/run.test.ts n’a pas été relancé jusqu’au bout ici : l’environnement est Node 22 (node:sqlite n’exporte pas backup). Les tests unitaires du compilateur, SSE, image-gate et latence ont passé (60 passed, 1 skipped, plus le run synthétique ci-dessus).

CI

Branche poussée : ci/no-github-hosted-main @ 450d0f0f0131795f89454439ee68f4f740b5ae72. La PR est toujours fermée (brouillon) ; GitHub affiche encore 084d140c comme head. Aucun nouveau check pull_request n’a démarré sur le merge. Sur l’ancien head, avant la fermeture : runner labels et typecheck + lint verts ; le job CI a été annulé par « Stop CI for closed PRs » ; le scan term-guard était rouge. Pour relancer la CI sur le merge, il faudrait réouvrir la PR (pas fait ici).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants