Automated summary
Queries PyTorch CI and infrastructure metrics across Grafana, ClickHouse, HUD, and GitHub Actions through an authenticated gcx wrapper to analyze durations, failures, and runner health.
Strengths
- Provides authenticated access to Grafana and ClickHouse datasources without manual setup, using a pinned and checksum-verified gcx binary
- Ships concrete example queries for top failing workflow jobs and per-test-file pass/fail counts
- Points to the right source repos (test-infra, ci-infra, actions-runner-controller) to understand how metrics are exported
- Encourages sensible filtering, e.g. scoping to pytorch/pytorch and being careful with the very large tests.all_test_runs table
Limitations
- Requires an authenticated gh CLI and Grafana access limited to repo write-permission holders, read-only only
- Tightly coupled to PyTorch's own ClickHouse and Prometheus datasets, so it is not reusable for other projects
- Assumes familiarity with ClickHouse SQL and PromQL to go beyond the provided example queries
Use it when a question needs numbers about PyTorch CI: job durations, failure rates, queue times, workflow trends, or runner health.
Avoid it for CI on non-PyTorch projects, or when you lack write permission on the repo and an authenticated gh session.
Security analysis
CautionThe skill is for legitimate CI metrics querying and contains no destructive, exfiltrating, or obfuscated instructions. However, it invokes an unaudited wrapper that downloads and runs a binary, uses network tools, and handles authentication tokens, so it warrants caution rather than a clean safe rating.
- •No allowed-tools are declared, yet the skill instructs executing a shell wrapper and requires network-capable tools (`gh`, `curl`).
- •The referenced `gcx-wrapper.sh` is not included in the provided SKILL.md, so its behavior cannot be audited here.
- •On first use the wrapper downloads and executes a pinned `gcx` binary, which is a remote-code-execution path even though checksum verification is claimed.
- •The skill handles Grafana authentication tokens via `gh`/HUD; access is described as read-only, but token handling remains sensitive.
- •It instructs cloning external repositories into temporary directories for guidance; this is benign but increases network and filesystem activity.
Examples
List the top 10 most failing workflow jobs in pytorch/pytorch on main over the last two weeks, with failure counts.For lazy/test_ts_opinfo.py over the past week, how many times did each test run, pass, fail, or get skipped?Using the PyTorch CI infrastructure metrics, which runner types had the worst queue times this week?name: ci-metrics description: Query PyTorch CI, GitHub Actions, HUD, Grafana, and infrastructure metrics. Use when users ask about CI duration, job failures, queue times, workflow trends, runner health, dashboard data, or PyTorch infrastructure metrics.
PyTorch CI Metrics
PyTorch CI and infrastructure metrics are exposed through Grafana. Use .claude/skills/ci-metrics/gcx-wrapper.sh for all Grafana access; it configures the PyTorch Grafana server, context, and authentication. Only users with write permission to the repo have access to Grafana. The authentication only provides read only access.
Requirements
The wrapper needs these tools on PATH:
gh- fetches the Grafana token and must be authenticated; if not, rungh auth login --hostname github.com --git-protocol ssh --web.curl- downloadsgcxand fetches the token from HUD.
On first use the wrapper downloads a pinned, checksum-verified gcx binary into a private cache (~/.cache/pytorch-ci-metrics/) and authenticates automatically. Nothing is installed on your PATH. If a tool is missing or gh is not authenticated, it exits with an error describing what to fix.
Datasources
Get the list of datasources available:
.claude/skills/ci-metrics/gcx-wrapper.sh datasources list
The data contains metrics for many repos owned by the PyTorch repo. When possible, restrict queries to just the pytorch/pytorch repository.
CI and Test Run Data
CI and test run data are stored in grafana-clickhouse-datasource. List all the available tables:
.claude/skills/ci-metrics/gcx-wrapper.sh datasources clickhouse list-tables
Important dataset:
- GitHub webhook data
- Database: default
- Note: the default database also contains other non-webhook related tables.
- Learn more about the event and payload: https://docs.github.com/en/webhooks/webhook-events-and-payloads
- Database: default
- Tests
- Database: tests
- tests.all_test_runs - contains every test run. This is an extremely large table, so be considerate with filtering and timing.
- Do not use tests.test_run_s3 as it contains partial data only.
To get additional guidance on common queries, clone https://github.com/pytorch/test-infra into a temporary directory and read the torchci folder.
Example Queries
Within the pytorch/pytorch repo on main, list the top most failing workflow jobs in the last 2 weeks:
.claude/skills/ci-metrics/gcx-wrapper.sh datasources clickhouse query "
SELECT name, count(DISTINCT id) AS failures
FROM default.workflow_job
WHERE conclusion = 'failure'
AND completed_at >= now() - INTERVAL 2 WEEK
AND repository_full_name = 'pytorch/pytorch'
AND head_branch = 'main'
GROUP BY name ORDER BY failures DESC LIMIT 10"
For a test file, how many times was it run in the last week? How many times did it pass or fail?
.claude/skills/ci-metrics/gcx-wrapper.sh datasources clickhouse query "
SELECT
file,
classname,
name,
count() AS runs,
countIf(failure_count = 0 AND error_count = 0 AND skipped_count = 0) AS successful,
countIf(failure_count > 0 OR error_count > 0) AS fails,
countIf(skipped_count > 0) AS skipped
FROM tests.all_test_runs
WHERE time_inserted >= now() - INTERVAL 7 DAY
AND file = 'lazy/test_ts_opinfo.py'
GROUP BY file, classname, name
ORDER BY runs DESC"
CI Infrastructure
CI infrastructure metrics are stored in grafanacloud-pytorchci-prom. To get a better understanding of the data, clone these repositories in a temporary directory:
- https://github.com/pytorch/ci-infra - In
/osdccontains the code for OSDC, the infra running PyTorch's CI. Read it to understand how metrics are exported and what metrics are available. Read the docs in /osdc/docs to understand the scope and project setup. - https://github.com/jeanschmidt/actions-runner-controller - To understand how actions-runner-controller exposes data.
Example Queries
Which runner types have the deepest queue right now (jobs assigned but not yet running)?
.claude/skills/ci-metrics/gcx-wrapper.sh datasources prometheus query -d grafanacloud-prom 'topk(10, clamp_min(sum by (name) (gha_assigned_jobs) - sum by (name) (gha_running_jobs), 0))'
How many jobs were running per cluster over the last 6 hours, sampled every 30 minutes? Use --since/--step (or --from/--to) for a range query:
.claude/skills/ci-metrics/gcx-wrapper.sh datasources prometheus query -d grafanacloud-prom 'sum by (cluster) (gha_running_jobs)' --since 6h --step 30m
From the file to a first result
The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.
View the source and supporting filesThis download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.
1. Download the file
Download SKILL.mdFrom the root of a test project, save the file as .skill-downloads/pytorch-ci-metrics-query-mte1lfj7/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.
Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.
mkdir -p '.skill-downloads/pytorch-ci-metrics-query-mte1lfj7' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/pytorch-ci-metrics-query-mte1lfj7/download' --output '.skill-downloads/pytorch-ci-metrics-query-mte1lfj7/SKILL.md.part' && mv '.skill-downloads/pytorch-ci-metrics-query-mte1lfj7/SKILL.md.part' '.skill-downloads/pytorch-ci-metrics-query-mte1lfj7/SKILL.md'2. Check prerequisites
Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.
Original excerpt: Requirements
The wrapper needs these tools on PATH:
gh- fetches the Grafana token and must be authenticated; if not, rungh auth login --hostname github.com --git-protocol ssh --web.curl- downloadsgcxand fetches the token from HUD.
On first use the wrapper downloads a pinned, checksum-verified gcx binary into a private cache (~/.cache/pytorch-ci-metrics/) and authenticates automatically. Nothing is installed on your PATH. If a tool is missing or gh is not authenticated, it exits with an error describing what to fix.
The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.
3. Load the skill
After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.
Claude Code
test -f '.skill-downloads/pytorch-ci-metrics-query-mte1lfj7/SKILL.md' && test -s '.skill-downloads/pytorch-ci-metrics-query-mte1lfj7/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/ci-metrics' && cp -R '.skill-downloads/pytorch-ci-metrics-query-mte1lfj7' '.claude/skills/ci-metrics'OpenSkills
OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.
Official OpenSkills installationopenskills install './.skill-downloads/pytorch-ci-metrics-query-mte1lfj7'openskills read 'pytorch-ci-metrics-query-mte1lfj7'Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.
For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.
openskills syncManual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.
4. Try a first task
Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:
Read .skill-downloads/pytorch-ci-metrics-query-mte1lfj7/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.
Configure a Chat Channel with SecretRefs
DevOps
Set up chat channels using non-interactive commands, with secrets only as SecretRefs. Covers gather, mutate, repair, and prove steps for reliable delivery.
Investigate ClickHouse CI Failures
DevOps
Investigate a ClickHouse CI failure end-to-end from a PR or S3 report URL. Fetches failed tests, classifies flaky vs real regression, and checks for existing issues/fixes.
Ansible PR Review
DevOps
Reviews an Ansible PR following the project's standardized process, including changelog checks, test coverage validation, and feedback tracking.