/self-hosted-runners:self-hosted-runner-preflightfrom self-hosted-runners
Pre-flight checklist for self-hosted runner failures. Investigates low disk, missing runner, or stuck Green Gate by comparing GitHub API state with host-level container state.
Ships in self-hosted-runners. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
gh api "orgs/$GITHUB_ORG/actions/runners" shows fewer than the expected count
($RUNNER_EXPECTED_LINUX + $RUNNER_EXPECTED_MAC)Read these from the environment (see the plugin README); when one is unset, report
<VAR> not configured and stop rather than guessing a host or path.
| Variable | Meaning |
|---|---|
GITHUB_ORG | Org that owns the runners (default: ${GITHUB_REPOSITORY%%/*}) |
RUNNER_HOST | SSH alias of the Linux runner host |
RUNNER_HOST_DOCKER_SOCK | Docker socket on that host (default unix:///var/run/docker.sock) |
RUNNER_COMPOSE_DIR | docker-compose directory for the Linux runners on that host |
RUNNER_INSTALL_DIR | Local runner install root (default ${XDG_DATA_HOME:-$HOME/.local/share}/self-hosted-runners) |
RUNNER_EXPECTED_LINUX / RUNNER_EXPECTED_MAC | Expected online runner counts |
For each failure class, answer BEFORE proposing a fix:
gh api "orgs/$GITHUB_ORG/actions/runners?per_page=100" --jq '.runners[] | {name,status,busy}'docker ps --format "{{.Names}}\t{{.Status}}" | grep org-runner-mac-ssh "$RUNNER_HOST" "DOCKER_HOST=${RUNNER_HOST_DOCKER_SOCK:-unix:///var/run/docker.sock} docker ps --format '{{.Names}}\t{{.Status}}' | grep org-runner-"docker exec <name> df -Pk / — needs >=1GB free for preflight to pass.docker ps -a --format "{{.Names}}\t{{.Status}}" | grep Restartingdocker logs --tail 30 <name> for 403/registration errors.Before a workflow relies on a CLI, verify the installed executable selected by the actual job environment: resolved path, version or executable hash, exact subcommand and required flags, with original command/exit evidence. A supported source checkout or capable stub is not installed capability proof. Reuse an applicable existing receipt rather than launching a duplicate job.
Inspect probe side effects first: even a lookup can create state directories. Use a verified non-mutating capability query or existing receipt where possible; if no permitted probe establishes support, report the capability as unverified. Do not change HOME/config/state to hide a registered volume, bypass the canonical resolver, hard-code a temporary fallback, or install a replacement to clear a failed probe. In particular, do not install a replacement under this preflight.
In the workflow owner's existing offline tests, include an unsupported-command negative case that fails closed and an uninitialized cleanup path. The negative case must stop before checkout/build/upload, preserve the original exit status and avoid cleanup against an unset or unowned path. A successful stub-only test qualifies the harness, not the installed CLI.
If upload already succeeded but reconciliation failed, preserve the release receipts and reconcile the original upload receipt before any retry. Capability qualification grants no cleanup, restart, credential, installation or release authority. Existing task-specific holds override any legacy recipe below.
self-hosted-oss/pre-job-hook.sh to add disk cleanup (fires on EVERY job, not periodic).AVAIL_KB="$(df -Pk "${RUNNER_WORKDIR}" 2>/dev/null | awk 'NR==2 {print $4}')"
if [[ "$AVAIL_KB" -lt "$DISK_MIN_KB" ]]; then
rm -rf /root/.cache/pip
rm -rf "${RUNNER_WORKDIR}/<repo>"
fi
DISK_MIN_KB=5242880 (5GB, 5x the preflight threshold).mac-runner-disk-cleanup.sh style).bash self-hosted-oss/install.sh syncs to $RUNNER_INSTALL_DIR/pre-job-hook.sh (bind-mounted live — no restart needed).docker exec <runner> bash -c 'pgrep Runner.Worker' returns empty (idle), then df -Pk / shows >=5GB.RUNNER_COUNT=<N> bash "$RUNNER_INSTALL_DIR/start-runner.sh" startssh "$RUNNER_HOST" "cd \"$RUNNER_COMPOSE_DIR\" && DOCKER_HOST=${RUNNER_HOST_DOCKER_SOCK:-unix:///var/run/docker.sock} docker compose up -d runner-<N>"docker ps | grep runner-<N> and gh api "orgs/$GITHUB_ORG/actions/runners" --jq '.runners[].name' | grep runner-<N>SKEPTIC_GATE_TRIGGER SHA pinned in PR comments to gh pr view <N> --json headRefOid.gh workflow run "MCP Smoke Tests" --ref <branch> -f pr_number=<N>
gh workflow run "Skeptic Self-Verify" --ref <branch> -f pr_number=<N>
gh workflow run green-gate.yml --ref <branch> -f pr_number=<N> -f head_sha=<sha>
pr_number; green-gate.yml ALSO requires head_sha.docker exec <name> bash -c 'echo ${#ACCESS_TOKEN}' (should be ~40).docker exec <name> curl -X POST -H "Authorization: token $ACCESS_TOKEN" -H "Accept: application/vnd.github+json" "https://api.github.com/orgs/$GITHUB_ORG/actions/runners/registration-token"gh auth token and re-deploy.$RUNNER_HOST) fully unreachable ("host dark")Distinct from Class B/D. Those assume the runner process is broken and a docker-level fix (restart, token rotate) will work. Class E is for when the entire physical host is unreachable — no SSH, no API response, nothing to restart, and (per standing org policy) no smart-plug/IPMI remote-power path to even attempt a hard reset. This class assumes an on-prem host with zero remote-power access; this is a known, accepted limitation, not a gap to fix here.
Two-signal confirmation (MANDATORY before declaring "host dark") — a
single failed signal is not sufficient; the skill's own wifi/subnet caveat
(see runner-health SKILL.md) means SSH timeout alone is frequently a false
positive when the operator is on a different network than the runner host:
Signal 1 — direct reachability from the operator's machine:
ssh -o ConnectTimeout=5 -o BatchMode=yes "$RUNNER_HOST" true; echo "ssh_exit=$?"
ping -c 2 -W 2 "$RUNNER_HOST"; echo "ping_exit=$?"
A non-zero exit on both is necessary but NOT sufficient on its own (could be local wifi/subnet routing, not a dead host).
Signal 2 — GitHub API shows ALL Linux-host runners idle simultaneously:
gh api "orgs/$GITHUB_ORG/actions/runners?per_page=100" \
--jq '.runners[] | select(.name | startswith("org-runner-")) | select(.name | test("mac") | not) | {name,status,busy}'
If EVERY Linux (non-mac) runner shows status:"online", busy:false (or
offline) with none in-flight, combined with Signal 1's timeout, that is
the confirmed two-signal "host dark" verdict. (A prior incident also saw
dig "$RUNNER_HOST" / host "$RUNNER_HOST" return NXDOMAIN — a bonus third
signal when local DNS is involved, but not required for the verdict.)
Do NOT declare host-dark from Signal 1 alone. If Signal 2 shows any
Linux runner busy:true, the host is alive and this is a network/wifi
false-positive — stop, do not proceed to the playbook below.
Playbook once both signals confirm host-dark:
<host-freeze-bead-id>, if your fleet tracks one). Do NOT open a new bead per recurrence; add evidence (date,
two-signal output) as a comment so the P1 stays a single source of truth.
br comments add --actor <you> <host-freeze-bead-id> -- "<date>: host dark, ssh+api both confirmed..."pgrep Runner.Worker first).$RUNNER_INSTALL_DIR/) — edit self-hosted-oss/, then bash install.sh to sync.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
4 skills in this plugin
/ezgha-watchdogRead-only fleet-size consumer for the 6 mac + 16 linux ezgha runner invariant. Restart-only remediation is UNAVAILABLE (fail-closed) pending the ezgha upstream repository (`$EZGHA_UPSTREAM_REPO`) PR 67 (dual-Lima convergence) and PR 70/issue 60 (recovery controller) merging AND being proven live-deployed — a 2026-07-09..11 audit found restarts can kill active jobs, create offline-busy 422 registrations, and cannot repair a dead/wrong-namespace backend. Use when the user says "make sure we have N mac and M linux runners", "ezgha fleet short", "supervisor stuck", or after any /runner-health AMBER/RED verdict — but diagnose with ez-gh-actions' doctor-runner first, never treat a shortfall as expected churn./repo-and-infra-locationsTemplate for looking up this machine's repository checkouts, ao CLI build path, AO YAML config rules, port assignments, and Hermes edit rules from machine-local configurationOther plugins' skills for the same job
/runner-healthOperational health snapshot for the self-hosted runner fleet of org $GH_ORG. Use when user says "check runners", "are runners up", "is the runner host down", "diagnose runner health", or before/after runner operations. Produces a structured Markdown report at /tmp/runner-health-<ts>.md with multi-method checks (GitHub API + local Docker + Lima VM + Linux runner host ssh + optional Slack cross-check). Works when the Linux runner host is unreachable (key insight: busy=true on runners is itself proof of liveness even when ssh fails).
npx claudepluginhub jleechanorg/jleechan-skills --plugin self-hosted-runners