[PR #5415] [MERGED] CI: same-repo checks and the bots on playhorizon's own runners #6272

Closed
opened 2026-11-03 06:17:12 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5415
Author: @ludovic111
Created: 10/31/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @ludovic111

Base: main ← Head: ci/playhorizon-runners


📝 Commits (5)

  • b7222a8 CI: same-repo checks and the bots on playhorizon's own runners
  • c8a8488 CI runners: GitHub's umask (0022) for the checks runners' jobs
  • 92523df Telemetry: threads are the machine's, as cores are
  • 96bcfc4 docs/ci-runners.md: measured times
  • 7fbfa2f net test: LAN login fixture waits 60 s, not 10

📊 Changes

12 files changed (+395 additions, -19 deletions)

View changed files

📝 .github/workflows/cancel-on-close.yml (+3 -1)
📝 .github/workflows/ci.yml (+26 -10)
📝 .github/workflows/claim-command.yml (+4 -2)
📝 .github/workflows/overlap-note.yml (+3 -1)
📝 .github/workflows/pr-labels.yml (+3 -1)
📝 crates/horizon-client/src/net.rs (+4 -2)
📝 crates/horizon-telemetry/src/system.rs (+20 -1)
📝 docs/README.md (+1 -0)
➕ docs/ci-runners.md (+72 -0)
📝 docs/release-flow.md (+1 -1)
➕ tests/test_ci_runners.py (+56 -0)
➕ tools/ci/checks-runners.sh (+202 -0)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

Why

GitHub gives the org 20 hosted jobs at a time. Measured on 2026-10-31 (18:40–19:45 UTC):

  • 400–460 runs queued, and 12–16 hosted jobs running.
  • Every job waits 20–25 min for a runner (median: checks 22.8, pr labels 26.2, overlap note 22.0) to do 0.3–4 min of work.
  • Hosted slot time over the last 2 h: 1420 slot-min (≈12 slots busy). Of that, checks was 72%, of which same-repo PRs plus main's pushes were 26%. The pull_request_target bots took 25%.

What

Jobs Before After
checks → verify, launcher (main's pushes, same-repo PRs) ubuntu-latest playhorizon-ci (2 runners)
checks → verify, launcher (fork PRs) ubuntu-latest ubuntu-latest (unchanged)
pr labels, overlap note, cancel-on-close, claim command, checks → parity-scope ubuntu-latest playhorizon-light (2 runners)
releases, nightly builds, signing, Windows/macOS builds, mod-registry, telemetry-server unchanged unchanged
  • Forks never run on our runners.
    • runs-on sends a pull_request to playhorizon only when head.repo.full_name == github.repository.
    • The bots run on pull_request_target, comments and schedules, so they only ever run main's own scripts.
    • A fork could still name the labels in its own copy of the workflow. The runners' ACTIONS_RUNNER_HOOK_JOB_STARTED hook fails any pull-request job whose head repo isn't ours, before its code is on disk.
    • The repo already requires approval for all external contributors.
    • tests/test_ci_runners.py pins this.
  • Kill switch: gh variable set SELF_HOSTED_CI --body off sends every routed job back to ubuntu-latest.
  • On playhorizon (tools/ci/checks-runners.sh, docs/ci-runners.md):
    • systemd user services, nice, pinned to CPUs 4–7 inside horizon-ci.slice. The checks have their own memory cap of 16 GB.
    • CPUs 0–3 stay for remote.sh runs, benchmarks and servers.
    • The runners share one cargo home. Each has its own rustup home and a build folder outside the checkout, emptied above 40 GB.
    • On these runners the jobs skip apt, setup-python and rust-cache.

Proof

This PR's own checks ran on the new runners: verify on playhorizon-ci-*, launcher on playhorizon-ci-*, parity-scope on playhorizon-light-*.

  • Run 1 (cold, 41232433026) failed, for two reasons:
    • The title keyboard test was broken on main itself (fixed by #5425).
    • The launcher's a_replaced_binary_is_replaced_again_at_its_path failed because a systemd user service's umask is 0002. Fixed: the units set UMask=0022, GitHub's.
  • Run 2 (41234272747) failed on horizon-telemetry's this_machine_is_described. This is a real bug: threads used available_parallelism(), which respects CPU affinity, while cores came from /proc/cpuinfo. A pinned process reported 8 cores and 4 threads. Fixed here: on Linux, threads counts the processors /proc/cpuinfo lists.
  • Run 3 (warm, 41235622864) ✅. The jobs waited 1 s for a runner.
Job GitHub's runners: wait + work playhorizon: wait + work
verify 20–25 min + ~8 min ~0 + 10.5 min (clippy 3.7, tests 5.0, Python 1.7)
launcher 20–25 min + 2.1 min ~0 + 2.5 min

The work itself is ~30% slower here: 4 CPUs shared with the parity runner, against a hosted runner's 4 of its own. The 20+ minutes of wait it saves are worth far more.

The job-started hook was tested on the host with fake events:

  • a fork's pull_request: exit 1;
  • a head repo that no longer exists: exit 1;
  • a same-repo pull_request: exit 0;
  • a fork's pull_request_target: exit 0, since that event runs main's code.

python3 -m unittest discover -s tests: OK. actionlint: clean on the changed workflows. cargo test and clippy -D warnings pass for horizon-telemetry.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/5415 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `ci/playhorizon-runners` --- ### 📝 Commits (5) - [`b7222a8`](https://github.com/horizon-rust/horizon/commit/b7222a864ab149138082b920a41cbcb0f7b1e62a) CI: same-repo checks and the bots on playhorizon's own runners - [`c8a8488`](https://github.com/horizon-rust/horizon/commit/c8a84885b3ada4f7a44bc858f4eca832322ea198) CI runners: GitHub's umask (0022) for the checks runners' jobs - [`92523df`](https://github.com/horizon-rust/horizon/commit/92523df6c2ebda12accb7f29817750092ae745f5) Telemetry: threads are the machine's, as cores are - [`96bcfc4`](https://github.com/horizon-rust/horizon/commit/96bcfc4ffe665009f2726d442188d1107822ef6a) docs/ci-runners.md: measured times - [`7fbfa2f`](https://github.com/horizon-rust/horizon/commit/7fbfa2f23d5ae416d3092f1a4a7aac10af8c0f42) net test: LAN login fixture waits 60 s, not 10 ### 📊 Changes **12 files changed** (+395 additions, -19 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/cancel-on-close.yml` (+3 -1) 📝 `.github/workflows/ci.yml` (+26 -10) 📝 `.github/workflows/claim-command.yml` (+4 -2) 📝 `.github/workflows/overlap-note.yml` (+3 -1) 📝 `.github/workflows/pr-labels.yml` (+3 -1) 📝 `crates/horizon-client/src/net.rs` (+4 -2) 📝 `crates/horizon-telemetry/src/system.rs` (+20 -1) 📝 `docs/README.md` (+1 -0) ➕ `docs/ci-runners.md` (+72 -0) 📝 `docs/release-flow.md` (+1 -1) ➕ `tests/test_ci_runners.py` (+56 -0) ➕ `tools/ci/checks-runners.sh` (+202 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## Why GitHub gives the org 20 hosted jobs at a time. Measured on 2026-10-31 (18:40–19:45 UTC): - **400–460 runs queued**, and 12–16 hosted jobs running. - Every job waits **20–25 min** for a runner (median: checks 22.8, pr labels 26.2, overlap note 22.0) to do 0.3–4 min of work. - Hosted slot time over the last 2 h: 1420 slot-min (≈12 slots busy). Of that, `checks` was 72%, of which same-repo PRs plus main's pushes were 26%. The `pull_request_target` bots took 25%. ## What | Jobs | Before | After | | --- | --- | --- | | `checks` → `verify`, `launcher` (main's pushes, same-repo PRs) | `ubuntu-latest` | `playhorizon-ci` (2 runners) | | `checks` → `verify`, `launcher` (fork PRs) | `ubuntu-latest` | `ubuntu-latest` (unchanged) | | `pr labels`, `overlap note`, `cancel-on-close`, `claim command`, `checks` → `parity-scope` | `ubuntu-latest` | `playhorizon-light` (2 runners) | | releases, nightly builds, signing, Windows/macOS builds, mod-registry, telemetry-server | unchanged | unchanged | - **Forks never run on our runners.** - `runs-on` sends a `pull_request` to playhorizon only when `head.repo.full_name == github.repository`. - The bots run on `pull_request_target`, comments and schedules, so they only ever run main's own scripts. - A fork could still name the labels in its own copy of the workflow. The runners' `ACTIONS_RUNNER_HOOK_JOB_STARTED` hook fails any pull-request job whose head repo isn't ours, before its code is on disk. - The repo already requires approval for all external contributors. - `tests/test_ci_runners.py` pins this. - **Kill switch:** `gh variable set SELF_HOSTED_CI --body off` sends every routed job back to `ubuntu-latest`. - **On playhorizon** (`tools/ci/checks-runners.sh`, `docs/ci-runners.md`): - systemd user services, nice, pinned to CPUs 4–7 inside `horizon-ci.slice`. The checks have their own memory cap of 16 GB. - CPUs 0–3 stay for `remote.sh` runs, benchmarks and servers. - The runners share one cargo home. Each has its own rustup home and a build folder outside the checkout, emptied above 40 GB. - On these runners the jobs skip apt, setup-python and rust-cache. ## Proof This PR's own checks ran on the new runners: `verify` on `playhorizon-ci-*`, `launcher` on `playhorizon-ci-*`, `parity-scope` on `playhorizon-light-*`. - **Run 1** (cold, 41232433026) failed, for two reasons: - The title keyboard test was broken on main itself (fixed by #5425). - The launcher's `a_replaced_binary_is_replaced_again_at_its_path` failed because a systemd user service's umask is 0002. Fixed: the units set `UMask=0022`, GitHub's. - **Run 2** (41234272747) failed on `horizon-telemetry`'s `this_machine_is_described`. This is a real bug: `threads` used `available_parallelism()`, which respects CPU affinity, while `cores` came from `/proc/cpuinfo`. A pinned process reported 8 cores and 4 threads. Fixed here: on Linux, `threads` counts the processors `/proc/cpuinfo` lists. - **Run 3** (warm, 41235622864) ✅. The jobs waited 1 s for a runner. | Job | GitHub's runners: wait + work | playhorizon: wait + work | | --- | --- | --- | | `verify` | 20–25 min + ~8 min | ~0 + 10.5 min (clippy 3.7, tests 5.0, Python 1.7) | | `launcher` | 20–25 min + 2.1 min | ~0 + 2.5 min | The work itself is ~30% slower here: 4 CPUs shared with the parity runner, against a hosted runner's 4 of its own. The 20+ minutes of wait it saves are worth far more. The job-started hook was tested on the host with fake events: - a fork's `pull_request`: exit 1; - a head repo that no longer exists: exit 1; - a same-repo `pull_request`: exit 0; - a fork's `pull_request_target`: exit 0, since that event runs main's code. `python3 -m unittest discover -s tests`: OK. `actionlint`: clean on the changed workflows. `cargo test` and `clippy -D warnings` pass for `horizon-telemetry`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:17:12 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#6272
No description provided.