Skip to main content

/ci-analyze - CI Failure Analysis

Group CI failures by likely root cause, identify flaky tests, and suggest minimal targeted fixes. Analyzes recent CI runs to distinguish genuine failures from intermittent issues.

System Prompt

EXECUTION DIRECTIVE: When the user invokes this command, you MUST:

  1. IMMEDIATELY execute - no questions first
  2. Load the agent ci-failure-analyzer
  3. Collect CI run data via gh run list and gh run view --log-failed
  4. Group failures by root cause signature
  5. Detect flaky tests by cross-referencing pass/fail on same commits
  6. Suggest fixes prioritized by impact
  7. Output structured analysis report

Usage

# Default: last 24 hours
/ci-analyze

# Longer window
/ci-analyze --window 7d

# Include passed runs for flake detection
/ci-analyze --include-passed

# Filter to specific workflow
/ci-analyze --workflow "integration-tests"

# Minimum flake runs threshold
/ci-analyze --min-flake-runs 10

Options

OptionDescriptionDefault
--windowTime window for collection24h
--workflowFilter to specific workflowall
--include-passedInclude passed runs for flake detectionfalse
--min-flake-runsMinimum runs to classify as flaky5
--flake-thresholdFailure rate to classify as flaky0.10
  • /flaky-tests - Deep-dive flaky test analysis with fix proposals
  • /smoke-test - Run smoke tests to verify current state
  • /regression-check - Check for test regressions in recent changes

Success Output

COMMAND COMPLETE: /ci-analyze
Window: last 24h
Total Runs: 45 | Failed: 8 (18%)
Root Cause Groups: 3
Flaky Tests: 2 identified
Top Fix: test_token_refresh race condition (blocks 40% of failures)

Completion Checklist

  • CI runs collected for window
  • Failure logs parsed
  • Root cause groups identified
  • Flaky tests detected
  • Fix suggestions generated
  • Priority ranking computed

Failure Indicators

  • GitHub CLI not authenticated
  • No CI runs in window
  • Cannot download failure logs

When NOT to Use

  • Single test debugging (use /debug or /smart-debug)
  • Performance testing (use /perf-profile)
  • Pre-deploy check (use /release-gate)

Anti-Patterns

Anti-PatternProblemSolution
Retry without analyzingHidden instabilityAnalyze root cause first
Fix symptoms onlyRecurring failuresGroup by root cause
Ignore flakesEroded CI trustTrack and fix systematically

Principles

  • #3 Complete Execution - Full analysis from collection to fix suggestions
  • #9 Based on Facts - Evidence from actual CI logs, not guesses

Full Standard: CODITECT-STANDARD-AUTOMATION.md