Job failure analyzer

From RHEcosystemAppEng/agentic-plugins · View interactive version

Job failure analyzer is an AI agent skill from the GitHub repository RHEcosystemAppEng/agentic-plugins. Extract and analyze failure events from AAP jobs to classify errors and reconstruct failure timelines. Use when: - "Job #X failed", "Why did the execution fail?" - "Analyze the failed job", "What went wrong?" - "Show me the failure details" NOT for: host fact correlation (use host-fact-inspector) or

How to use this skill

Skill file

Job Failure Analyzer

Prerequisites

Required MCP Servers:

Verification: Run the aap-mcp-validator skill with aap-mcp-job-management before proceeding.

When to Use This Skill

Use this skill when:

Do NOT use when:

Workflow

Step 1: Consult Troubleshooting Documentation

CRITICAL: Document consultation MUST happen BEFORE any MCP tool invocations.

Document Consultation (REQUIRED - Execute FIRST):

  1. Action: Read job-troubleshooting.md using the Read tool to understand event extraction, failure patterns, host summary interpretation, and root cause classification
  2. Output to user: "I consulted job-troubleshooting.md which references Red Hat's AAP 2.6 Troubleshooting Guide for failure analysis patterns."

Step 2: Retrieve Job Status

MCP Tool: jobs_retrieve (from aap-mcp-job-management)

Parameters:

Extract: status, failed, job_type, elapsed, launch_type.

Per job-troubleshooting.md, the status determines the analysis path:

Step 3: Extract Failure Events

MCP Tool: jobs_job_events_list (from aap-mcp-job-management)

Parameters:

Filter for failure-related events:

From each failure event, extract:

Step 4: Retrieve Host Summaries

MCP Tool: jobs_job_host_summaries_list (from aap-mcp-job-management)

Parameters:

Map each host's ok, changed, failures, dark, skipped counts.

Step 5: Classify the Failure

Apply the classification from job-troubleshooting.md:

| dark > 0 | failures > 0 | Classification |

|---|---|---|

| Yes | No | Platform issue: Host connectivity |

| No | Yes | Code/Config issue: Task failure |

| Yes | Yes | Mixed: Both connectivity and task issues |

For each runner_on_failed event, match against the failure patterns in job-troubleshooting.md:

Step 6: Reconstruct Failure Timeline

Sort events by counter and produce a chronological failure narrative:

  1. First failure event (root cause candidate)
  2. Subsequent failures (cascade effects)
  3. Final stats (scope of impact)

Step 7: Generate Failure Analysis Report

Output format (per job-troubleshooting.md template):

## Job Failure Analysis: Job #[job_id]

**Job Status**: [status]
**Elapsed Time**: [elapsed]s
**Launch Type**: [launch_type]

### Failure Timeline

1. [counter] - Task "[task_name]" on host "[hostname]": [event_type]
   Error: "[error_message]"
   Module: [module_name]
2. [subsequent failure events]

### Host Summary

| Host | OK | Changed | Failed | Unreachable |
|---|---|---|---|---|
| [host1] | [ok] | [changed] | [failures] | [dark] |

### Preliminary Classification

**Type**: [Platform / Code / Configuration] Issue
**Pattern Match**: [Pattern name from failure patterns reference]
**Evidence**: Per Red Hat's Troubleshooting Guide: "[relevant guidance from job-troubleshooting.md]"
**Root Cause Candidate**: [first failure event analysis]

### Next Steps

- Host fact correlation recommended: [yes/no, with affected hostnames]
- Resolution advisory recommended: [yes/no, with error pattern]

Dependencies

Required MCP Servers

Required MCP Tools

Related Skills

Reference Documentation

Example Usage

User: "Job #4451 failed halfway through. Analyze the logs."

Agent:

  1. Reads job-troubleshooting.md
  2. Reports: "I consulted job-troubleshooting.md which references Red Hat's AAP 2.6 Troubleshooting Guide."
  3. Retrieves job #4451 → status: failed
  4. Extracts events → finds runner_on_failed on task "Install security package" with ansible.builtin.dnf, msg: "No package matching 'nonexistent-package'"
  5. Retrieves host summaries → 1 host with failures=1
  6. Classifies: Code Error (Pattern 2: Module Failure - Package Operations)
  7. Reports structured analysis with timeline, classification, and next steps
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.