openshift-eng/ai-helpers/detect-permafail

Claude Code and agent skill by openshift-eng/ai-helpers

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Analyze consecutive job failures to determine if they represent a permafail pattern versus flaky failures

Install

npx vskill@latest install openshift-eng/ai-helpers/detect-permafail

SKILL.md

The same SKILL.md was published earlier as openshift-eng/ai-helpers/detect-permafail.

Detect Permafail

When to Use This Skill

Use this skill when you have 2-10 consecutive failures of the same job and need to determine if the failures represent a systematic/permanent failure (permafail) versus a flaky failure. This is critical for CI/CD pipeline analysis to distinguish between:

  • Permafail: A systematic failure affecting the same test(s) or infrastructure issue, detected by analyzing comparable runs (same failure type):
  • 2-3 comparable runs: All must have the same failure (100% match)
  • 4-5 comparable runs: At least 4 must have the same failure (80% match)
  • 6-10 comparable runs: At least ceil(count × 0.7) must have the same failure (70% match)
  • Flaky: Non-deterministic failures with varying root causes, or failures that don't meet the permafail thresholds

Prerequisites

  • Access to OpenShift CI Prow job artifacts via gcsweb URLs
  • Access to the Bash tool for running plugins/ci/scripts/classify-job-failures.py
  • Python with the requests package available for artifact fetching
  • Knowledge of Prow artifact structure (from fetch-prowjob-json and prow-job-artifact-search skills)
  • 2-10 URLs pointing to consecutive job failures (from Prow/OpenShift CI, ordered newest to oldest)
  • Job name context to verify consistency across all failures
  • PR information to provide context for analysis

Implementation Steps

Step 1: Validate Inputs

Standard Mode (URL-based):

Verify that all required inputs are present with expected types and constraints:

  • failure_urls: Array of 2-10 strings matching Prow job URL pattern https://prow.ci.openshift.org/view/gs/<bucket>/<path>/<job-name>/<build-id> where path may be logs/, pr-logs/pull/, or other GCS paths (must be consecutive runs, ordered newest to oldest)
  • job_name: Non-empty string identifier of the job being analyzed
  • pr_info: Object containing PR number (integer) and repository context (string)
  • Each URL must match the Prow job URL pattern above

Reject requests if:

  • URLs count is less than 2 or more than 10
  • Job names don't match across all URLs (validate via prowjob.json metadata, not path position)
  • PR context is missing

Notes:

  • URL ordering (newest first) is assumed but not validated - the frontend provides them in this order
  • Job name validation should check prowjob.json metadata or verify the name appears in the extracted GCS path, not assume a fixed path position (presubmit URLs include org/repo/pr segments)

Offline/Eval Mode (Pre-normalized Signatures):

For testing or offline analysis, the skill can accept pre-normalized failure signatures directly instead of fetching from URLs. This mode skips Steps 2-4 (artifact fetching and classification) and proceeds directly to Step 5 (threshold analysis).

Input format:

  • signatures: Array of 2-10 pre-normalized signature objects (see Step 4 output format)
  • Each signature must be either test_failure format {type: "test_failure", url: "...", tests: [...], test_count: N} or infra_failure format {type: "infra_failure", url: "...", error: "...", error_hash: "..."}

When signatures are provided, skip to Step 5 and apply threshold logic directly. Use this mode only for evals or when signatures have been extracted by another tool.

Step 2: Classify Job Failures with Script

For standard URL-based analysis, call the deterministic classifier script to fetch artifacts and produce normalized signatures:

bash
"$SKILL_DIR/../../scripts/classify-job-failures.py" --json-input '{
"failure_urls": ["https://prow.ci.openshift.org/view/gs/..."],
"job_name": "pull-ci-openshift-origin-master-e2e-aws",
"pr_info": {"pr_number": 12345, "repository": "openshift/origin"}
}'

The script performs the artifact-based work that does not require AI judgment:

  1. Parses the full GCS path from each Prow URL.
  2. Fetches prowjob.json from gcsweb.
  3. Browses the artifacts directory.
  4. Classifies each run as test_failure or infra_failure based on artifacts, not error text alone.
  5. Extracts failing test names from junit/build logs or normalized infrastructure errors.
  6. Returns the Step 4 normalized signature array.

If the script exits non-zero, report its JSON error and do not continue to threshold analysis unless at least two valid signatures are available from another trusted source.

Step 3: Artifact Classification Rules

The classifier follows these rules:

  • TEST_FAILURE when artifacts contain openshift-e2e-test/, e2e-*, junit/, junit XML files, openshift-tests-*, or monitor-test-*.
  • INFRA_FAILURE only when artifacts show setup/build/gather output without test artifacts, or artifacts are empty/unavailable after a valid job fetch.
  • MonitorTest failures count as test failures because MonitorTests run during e2e execution.
  • Classification must be artifact-based. Do not classify from Prow descriptions or error messages alone.
Step 4: Use Normalized Failure Signatures

Use the script output directly as the normalized signature array.

For test failures:

json
{
"type": "test_failure",
"url": "job_url",
"tests": ["failing_test_name1", "failing_test_name2"],
"test_count": 2
}

For infrastructure failures:

json
{
"type": "infra_failure",
"url": "job_url",
"error": "normalized_error_message",
"error_hash": "md5_of_error_message"
}
Step 5: Compare Signatures for Permafail Pattern

Apply permafail detection logic using failure-type-based thresholds - the denominator is the count of comparable runs (same failure type), not the matching group size:

Detection Thresholds (based on comparable run count):

  • 2-3 comparable runs: All must match (100% match required)
  • 4-5 comparable runs: At least 4 must match (80% match required)
  • 6-10 comparable runs: At least ceil(count × 0.7) must match (70% threshold)

For Test Failures:

  1. Count total test_failure signatures (this is the denominator)
  2. Extract all unique test names from test_failure signatures
  3. For each unique test name, count how many test_failure signatures contain it (this is the numerator)
  4. Apply threshold based on the denominator (total test_failure count):
  • If denominator is 2-3: numerator must equal denominator (100%)
  • If denominator is 4-5: numerator must be ≥4 (80%)
  • If denominator is 6-10: numerator must be ≥ceil(denominator × 0.7) (70%)
  1. If ANY test name meets its threshold: PERMAFAIL = TRUE
  • Report which test(s) met the threshold and their occurrence count
  1. If no test meets the threshold: PERMAFAIL = FALSE

Example: 8 test_failure signatures, "TestNetworkPolicy" appears in 6 → 6/8 = 75% → needs ceil(8×0.7)=6 → 6≥6 ✓ PERMAFAIL

For Infrastructure Failures:

  1. Count total infra_failure signatures (this is the denominator)
  2. Extract error messages and group similar errors (exact match or >70% character similarity using normalized Levenshtein: similarity = 1 - (levenshtein_distance(a, b) / max(len(a), len(b))). Treat two normalized errors as similar when similarity > 0.70. If both strings are empty, do not group them as similar; require a non-empty normalized error.)
  3. For each error group, count how many infra_failure signatures contain it (this is the numerator)
  4. Apply threshold based on the denominator (total infra_failure count):
  • If denominator is 2-3: numerator must equal denominator (100%)
  • If denominator is 4-5: numerator must be ≥4 (80%)
  • If denominator is 6-10: numerator must be ≥ceil(denominator × 0.7) (70%)
  1. If ANY error group meets its threshold: PERMAFAIL = TRUE
  • Report the error message and occurrence count
  1. If no error group meets the threshold: PERMAFAIL = FALSE

Example: 5 infra_failure signatures - 3 have "operator X timeout", 2 have random errors → 3/5 = 60% → needs 4/5 (80%) → 3<4 → NOT PERMAFAIL

For Mixed Failure Types:

  1. Separate signatures by type (test_failure vs infra_failure)
  2. For each type, count total signatures (the denominator for that type)
  3. Apply threshold logic to each type independently:
  • Test failures: If ≥2 test_failure signatures exist, check if any test appears frequently enough to meet the threshold based on test_failure count
  • Infra failures: If ≥2 infra_failure signatures exist, check if any error appears frequently enough to meet the threshold based on infra_failure count
  1. Minimum runs requirement: Need at least 2 runs of the same type to establish a permafail pattern. A single failure of either type is insufficient.
  2. If either type meets the threshold AND has ≥2 runs: PERMAFAIL = TRUE
  • Report the dominant pattern (the one that triggered permafail)
  • Explain which runs contributed and which were ignored (e.g., "All 4 runs that reached e2e tests failed on TestNetworkPolicy. 3 other runs failed during cluster setup and are not relevant to this test failure pattern.")
  1. If neither type meets criteria: PERMAFAIL = FALSE

Example Scenario 1: PERMAFAIL (4 test, 3 infra):

  • 7 total runs provided
  • 3 runs: infra_failure (cluster creation failed)
  • 4 runs: test_failure (all failing on TestNetworkPolicy)

Analysis:

  • Test failures: 4 runs → use 4/5 threshold (80%) → need 4 matching → have 4/4 (100%) ✓ PERMAFAIL
  • Infra failures: 3 runs → use 3/3 threshold (100%) → different errors → NOT permafail
  • Verdict: PERMAFAIL = TRUE (test failure group met criteria)
  • Reason: "All 4 runs that reached e2e tests failed on TestNetworkPolicy (100% match). 3 additional runs failed during infrastructure setup and are not relevant to this test failure pattern."

Example Scenario 2: NOT PERMAFAIL (1 test, 6 diverse infra):

  • 7 total runs provided
  • 6 runs: infra_failure (each with different errors: cluster creation timeout, AWS quota, network issue, pod eviction, storage failure, DNS timeout)
  • 1 run: test_failure (failed on TestNetworkPolicy)

Analysis:

  • Test failures: 1 run → INSUFFICIENT (need minimum 2 runs to establish pattern)
  • Infra failures: 6 runs with all different errors → no single error appears ≥5 times → NOT permafail
  • Verdict: PERMAFAIL = FALSE
  • Reason: "Only 1 out of 7 runs reached e2e tests and failed on '[sig-arch] daemonset cni-sysctl-allowlist-ds maxUnavailable requirement'. The other 6 runs failed during infrastructure setup, each with different unrelated issues (no consistent infra pattern). A single test failure is insufficient to establish a permafail pattern - we need multiple runs with consistent failures to confirm systematic breakage."
Step 6: Generate Verdict and Return JSON

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
112
Repository forks
305
7-day trend score
24

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/openshift-eng/ai-helpers/detect-permafail/badge)](https://verified-skill.com/skills/openshift-eng/ai-helpers/detect-permafail)

Something wrong with this skill or its page? Tell us.