agentleFS
bInference-LabbInference-Lab/bInference/.agents/skills/tune-ci/SKILL.md

tune-ci

Skill2 starsChanged 2 days agoMITView on GitHub

Changes the GitHub workflows without making CI slower, costlier or less safe, and finds why a run waits or takes long. Use when you add or edit a job in .github/workflows, add a matrix row, or a run sits queued or runs past its usual time.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Read the run before you change a workflow:

    line 37
  2. Very specific:

    Every job sets timeout-minutes close to its slowest normal run plus a margin, never the default six hours.

    line 57
  3. Very specific:

    Every workflow sets permissions: contents: read and a concurrency group.

    line 59
  4. Distinctive:

    No secret reaches a job that runs code from a pull request.

    line 64
  5. Very specific:

    Run actionlint and zizmor --offline .github/ on the changed workflow.

    line 75

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Tune CI

CI runs on GitHub-hosted runners only, on pushes to master and each night, never on a branch push or a pull request (decision 0294). Every job a change adds runs on each push to master, often on three operating systems. Count before you add.

1. Know what runs

WorkflowWhenJobs
ci.ymleach push to master, by handpnpm check less its tests and gate self-test, check:gates, the tests in 3 shards and their merge, OS adapters and the service smoke on macOS; commits and scans; Postgres by hand
codeql.ymlMonday 05:37 UTC, by handCodeQL's security queries on the TypeScript and JavaScript sources, on Linux
mutation.ymlby handStryker on up to 12 files changed since a base, 45 minutes at most
fork.ymlnightly 03:41 UTC, by handthe fork suite on Linux
crash.ymlnightly 04:23 UTC, by handthe crash suite in 17 parts on macOS, 3 at a time, BINFERENCE_CRASH_RUNS runs per kill point
packed.ymlnightly 00:37 UTC, by handthe Node pins and both packs on Linux; the smoke, one-liner and first day on macOS
image.ymlby handthe Docker image suite on Linux amd64
nightly.ymlnightly 02:17 UTC, a full run on SundayStryker in 20 shards with saved results
release.ymla pushed v* tag (dry), by hand to publishpnpm release:dry and the smoke on macOS (decision 0449); npm and GitHub's release

A push to master starts 10 jobs (decision 0454, and check:gates in a job of its own); a night starts 43, and Monday adds the weekly CodeQL run (decision 0453). A newer push to master cancels the CI run of the older one, while the nightly suites never cancel. The nightly workflows start at different times so their jobs do not queue behind each other. A release tag starts 2 jobs in release.yml, and a publish run 4 (decisions 0353, 0354 and 0449); none restores a cache.

check:pr is no CI job: the merger runs it on the branch's range before the merge, as pnpm check:pr master..<branch>, with --title and --body <file> for a squash merge.

2. Find the bottleneck first

Read the run before you change a workflow:

gh run list --workflow ci.yml --limit 10
gh run view <run-id> --json jobs --jq '.jobs[] | [.name, .status, .startedAt, .completedAt] | @tsv'
gh run view <run-id> --log-failed
  • Queued, no runner yet: the account's concurrent job limit is full, often with nightly shards or several pushes to master. Fewer parallel rows help; a bigger timeout does not.
  • Started late: a needs: dependency held it, or the cache restore was slow.
  • One step dominates: usually a test shard. Read Turborepo's summary for a cache miss, then use speed-up-tests on the slow files.
  • Fails on one OS only: a path, a line ending, a permission or a service manager difference. Fix it in platform, never by skipping the OS.
  • Fork job flakes: public BSC nodes answer bursts with 403 for up to a minute. The fork helpers wait and try again; a new test with many reads at once needs the same.

3. Rules for a workflow change

  • Every job sets timeout-minutes close to its slowest normal run plus a margin, never the default six hours.
  • Every workflow sets permissions: contents: read and a concurrency group. A job that needs more names it at the job, with a comment, as CodeQL does for security-events: write.
  • Actions are pinned to a full commit SHA with the version in a comment. A downloaded tool is pinned by version and checked against its published SHA-256.
  • actions/checkout keeps persist-credentials: false.
  • No secret reaches a job that runs code from a pull request. The fork and crash suites hold no key and must stay that way.
  • pnpm check and the OS jobs run on macOS while the release supports macOS alone (decisions 0449 and 0453); a Linux or Windows row returns to each OS matrix with its OS, under rule OS-6 of docs/ENGINEERING.md. A job that reads no OS behavior, such as a scan or the commit message check, runs on Linux alone: macOS and Windows minutes cost more.
  • A change to Windows-specific code runs CI by hand on its branch (workflow_dispatch), or its tests on Windows, before the push that merges it: CI on master sees it only after the merge.
  • A red master run stops the line: nothing else is pushed until the fix is.
  • A new shard count, a new nightly job or a new required check is load-bearing: run write-adr with the job count per push and per night, and the time it saves.
  • Run actionlint and zizmor --offline .github/ on the changed workflow. CI runs both, with OpenGrep and the audit; .github/zizmor.yml says why each disabled audit is off.

4. Check the effect

Compare three runs before and three after: queued time, run time per job and the total minutes per OS. A change that saves time on Linux and adds a macOS row may cost more than it saves.

5. Report

What waited or ran long and why, the change, the job count per push before and after, the numbers from step 4, and the run links.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.