ci: Evaluate with nix-eval-jobs and cancel superseded runs #9

Merged
dev merged 2 commits from ci-eval-jobs into master 2026-11-26 22:07:15 +00:00

CI runs on master take 69–77 minutes, and only about 8 of those are spent building. These changes cut most of the rest.

Where the time went (run 6182, 69 min)

Phase Time
Evaluating each job before building it, including serial IFD ~36 min
Evaluating each job again for push-to-cache.sh ~9.5 min
IFD-mode nix flake check ~8.5 min
Evaluating ciDrv ~3 min
Building and fetching ~8.5 min

Changes

  • Cancel superseded runs. concurrency with cancel-in-progress (Gitea 28.3 supports it).
  • Evaluate once with nix-eval-jobs. It runs a pool of 4 workers, each capped at 6 GiB.
    • Each fresh evaluation pays ~15s and ~3.8 GiB for the flake itself; after that, a job costs ~2s. Long-lived workers pay that cost once each instead of 47 times.
    • With IFD on, the workers wait on the reference-graph builds in parallel.
  • Build once. A single nix build --keep-going builds every evaluated derivation, then one nix copy pushes everything that built. Any failure still fails the run before the profile changes.
  • Drop ciDrv. The profile's link farm is built from the known output paths with builtins.storePath, taking under a second, so it doesn't evaluate everything again.
  • ci/push-to-cache.sh now takes several paths.

Memory

  • Git VM: 40 GiB, no swap, ~2.6 GiB used at idle, and no OOM kills in the last 30 days.
  • Today's peak: in run 6182, netdata showed ~24 GiB used during the whole-flake evaluations (the flake check and ciDrv).
  • New budget: the eval cap is 4 × 6 GiB = 24 GiB, which nix-eval-jobs enforces across workers. It leaves ~13 GiB for Gitea and for builds the daemon starts during IFD. CI_EVAL_WORKERS and CI_EVAL_WORKER_MEMORY override it.

Testing

ci.yaml only runs on pushes to master, so the new script hasn't run in CI. Local runs on slop-cannon:

  • Without IFD: nix-eval-jobs evaluated all 46 jobs in 145s, with combined worker RSS peaking at 21 GiB. The 28 jobs on the patched channel stopped with the expected IFD-disabled error.
  • With IFD: system-qclk evaluated through the daemon's IFD builds and produced its patched derivation.
  • Later stages: these ran against that real jobs.json, with pushing and the build stubbed out. The link farm was also checked with builtins.storePath, and its references are kept.

The json-c replacement still forces IFD. Dropping it, as its TODO plans, removes the remaining IFD cost.

🤖 Generated with Claude Code

CI runs on `master` take 69–77 minutes, and only about 8 of those are spent building. These changes cut most of the rest. ## Where the time went (run 6182, 69 min) | Phase | Time | |---|---| | Evaluating each job before building it, including serial IFD | ~36 min | | Evaluating each job again for `push-to-cache.sh` | ~9.5 min | | IFD-mode `nix flake check` | ~8.5 min | | Evaluating `ciDrv` | ~3 min | | Building and fetching | ~8.5 min | ## Changes - **Cancel superseded runs.** `concurrency` with `cancel-in-progress` (Gitea 28.3 supports it). - **Evaluate once with `nix-eval-jobs`.** It runs a pool of 4 workers, each capped at 6 GiB. - Each fresh evaluation pays ~15s and ~3.8 GiB for the flake itself; after that, a job costs ~2s. Long-lived workers pay that cost once each instead of 47 times. - With IFD on, the workers wait on the reference-graph builds in parallel. - **Build once.** A single `nix build --keep-going` builds every evaluated derivation, then one `nix copy` pushes everything that built. Any failure still fails the run before the profile changes. - **Drop `ciDrv`.** The profile's link farm is built from the known output paths with `builtins.storePath`, taking under a second, so it doesn't evaluate everything again. - `ci/push-to-cache.sh` now takes several paths. ## Memory - **Git VM:** 40 GiB, no swap, ~2.6 GiB used at idle, and no OOM kills in the last 30 days. - **Today's peak:** in run 6182, netdata showed ~24 GiB used during the whole-flake evaluations (the flake check and `ciDrv`). - **New budget:** the eval cap is 4 × 6 GiB = 24 GiB, which `nix-eval-jobs` enforces across workers. It leaves ~13 GiB for Gitea and for builds the daemon starts during IFD. `CI_EVAL_WORKERS` and `CI_EVAL_WORKER_MEMORY` override it. ## Testing `ci.yaml` only runs on pushes to `master`, so the new script hasn't run in CI. Local runs on `slop-cannon`: - **Without IFD:** `nix-eval-jobs` evaluated all 46 jobs in 145s, with combined worker RSS peaking at 21 GiB. The 28 jobs on the patched channel stopped with the expected IFD-disabled error. - **With IFD:** `system-qclk` evaluated through the daemon's IFD builds and produced its patched derivation. - **Later stages:** these ran against that real `jobs.json`, with pushing and the build stubbed out. The link farm was also checked with `builtins.storePath`, and its references are kept. The json-c replacement still forces IFD. Dropping it, as its TODO plans, removes the remaining IFD cost. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
slop-cannon Bot added 1 commit 2026-11-26 20:33:32 +00:00
A run builds every system for an hour or more, and only the newest
commit on `master` needs building and caching.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
slop-cannon Bot added 1 commit 2026-11-26 21:56:44 +00:00
ci: Evaluate with a pool of nix-eval-jobs workers
Build llm-agents / build (pull_request) Skipped
037ac8b1c0
Each CI job ran in its own `nix build`, and its output path came from
a second `nix eval`. Every one of those evaluations paid ~15s and
~4 GiB to evaluate the flake before reaching its job, and import from
derivation stalled each job in turn. The final `ciDrv` evaluation
covered every job once more.

Evaluate everything once with `nix-eval-jobs` instead: workers keep
the shared evaluation for several jobs and wait on import from
derivation in parallel, and the worker count and memory bound cap
evaluation at 24 GiB of the 40 GiB `git` VM. Build every job in one
`nix build --keep-going`, push the results in one copy, and build the
profiled link farm from the known output paths, which makes `ciDrv`
unnecessary.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
slop-cannon Bot force-pushed ci-eval-jobs from 10aa3228be to 037ac8b1c0 2026-11-26 21:56:44 +00:00 Compare

Replaced the bash build script with ci/build-and-cache.py (same stages and behaviour), in the same commit. The workflow runs it through nix shell with the pinned python3 and nix-eval-jobs, as update-llm-agents already does.

Tested with a fake nix-eval-jobs that replays the real results from the local run, plus a stubbed push and a no-op nix build:

  • Failure path: 28 evaluation errors become escaped ::error annotations, the outputs that built are still pushed, and the script exits 1 before touching the profile.
  • Success path: 14 jobs build and are pushed, and the link farm is built from their paths, with 14 links and 14 references. The script exits 0.
Replaced the bash build script with `ci/build-and-cache.py` (same stages and behaviour), in the same commit. The workflow runs it through `nix shell` with the pinned `python3` and `nix-eval-jobs`, as `update-llm-agents` already does. Tested with a fake `nix-eval-jobs` that replays the real results from the local run, plus a stubbed push and a no-op `nix build`: - **Failure path:** 28 evaluation errors become escaped `::error` annotations, the outputs that built are still pushed, and the script exits 1 before touching the profile. - **Success path:** 14 jobs build and are pushed, and the link farm is built from their paths, with 14 links and 14 references. The script exits 0.
dev merged commit d0eed3943d into master 2026-11-26 22:07:15 +00:00
dev deleted branch ci-eval-jobs 2026-11-26 22:07:15 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dev/nixfiles#9