detect-permafail

detect-permafail is a command for Claude Code from openshift-eng/ai-helpers. It costs 9 tokens per session (557 once invoked), scanned A, original, Apache-2.0.

A command that compares two to ten consecutive failures of the same CI job to classify them as a permafail or a flaky failure. A permafail is a repeatable failure; a flaky failure happens inconsistently.

In plain words
What is it for?
Use it to compare failure signatures, separate test failures from infrastructure failures, and decide whether a job needs permanent repair or further observation.
Why use it?
It helps distinguish a lasting test or infrastructure problem from failures caused by changing or unreliable conditions.

Command for Claude Code

Written for Claude Code: argument-hint in frontmatter.

Part of the ci plugin — 34 skills, 21 commands, 2 agents shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/openshift-eng/ai-helpers/detect-permafail
Clone the repo
git clone --depth 1 https://github.com/openshift-eng/ai-helpers

Made for: Claude Code.

Or install ci, the plugin that ships this one along with the rest of its 34 skills, 21 commands, 2 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for detect-permafail

README.md
[![agentmods](https://agentmods.dev/badge/commands/openshift-eng/ai-helpers/detect-permafail.svg)](https://agentmods.dev/commands/openshift-eng/ai-helpers/detect-permafail)
Your own site
<a href="https://agentmods.dev/commands/openshift-eng/ai-helpers/detect-permafail"><img src="https://agentmods.dev/badge/commands/openshift-eng/ai-helpers/detect-permafail.svg" alt="Measured on agentmods" height="20"></a>
Per session 9 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 557 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00009 $0.00557
Opus 5 $0.00005 $0.00279
Sonnet 5 $0.00002 $0.00111
Haiku 4.5 $0.00001 $0.00056

Measured 6d ago against content hash 6a9b3863084d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

detect-permafail scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/ci/commands/detect-permafail.md · 47 lines

How it starts

The opening of the file, as written. The whole thing — 47 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Name

ci:detect-permafail

Synopsis

/ci:detect-permafail --job-urls="[url1,url2,...]" --job-name="job-name" --pr="owner/repo#123"

Description

Analyzes 2-10 consecutive failures of the same job to determine if they 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):
    • Separates test failures from infrastructure failures
    • Applies thresholds based on comparable run count (not total URLs)
    • 2-3 comparable runs: All must match (100% required)
    • 4-5 comparable runs: At least 4 must match (80% required)
    • 6-10 comparable runs: At least ceil(count×0.7) must match (70% required)
    • Example: 7 URLs where 5 are test failures and 4 of those 5 have same test → 4/5 = 80% → PERMAFAIL
  • Flaky: Non-deterministic failures with varying root causes, or failures that don't meet the permafail thresholds

How It Works

The command uses a deterministic Python classifier script for artifact-based failure classification, compares failure signatures across runs, and returns a JSON result with the permafail verdict, confidence score, failure type, and detailed signatures for each run.

Implementation

  • Load the "detect-permafail" skill
  • Pass the job URLs, job name, and PR info to the skill
  • The skill handles all analysis including:
    • Artifact fetching and classification via plugins/ci/scripts/classify-job-failures.py
    • Signature comparison and pattern detection
    • Threshold-based permafail determination

Arguments

  • --job-urls: JSON array of 2-10 consecutive Prow job URLs (required, newest first)
  • --job-name: Name of the job being analyzed (required, e.g., "e2e-aws-ovn")
  • --pr: PR identifier (required, format: "owner/repo#number")

Prerequisites

  • Access to Prow CI job artifacts via gcsweb URLs
  • Access to Bash for running the classifier script
  • Python with the requests package available

Read the full file on GitHub · 47 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 47 lines · 9 tokens per session scan A 6a9b3863084d

Subscribe to this mod's changes

detect-permafail is a command published in the GitHub repository openshift-eng/ai-helpers (116 stars, last pushed yesterday), licensed Apache-2.0. It adds 9 tokens to every session and 557 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.