/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:
- IMMEDIATELY execute - no questions first
- Load the agent
ci-failure-analyzer - Collect CI run data via
gh run listandgh run view --log-failed - Group failures by root cause signature
- Detect flaky tests by cross-referencing pass/fail on same commits
- Suggest fixes prioritized by impact
- 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
| Option | Description | Default |
|---|---|---|
--window | Time window for collection | 24h |
--workflow | Filter to specific workflow | all |
--include-passed | Include passed runs for flake detection | false |
--min-flake-runs | Minimum runs to classify as flaky | 5 |
--flake-threshold | Failure rate to classify as flaky | 0.10 |
Related Commands
/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
/debugor/smart-debug) - Performance testing (use
/perf-profile) - Pre-deploy check (use
/release-gate)
Anti-Patterns
| Anti-Pattern | Problem | Solution |
|---|---|---|
| Retry without analyzing | Hidden instability | Analyze root cause first |
| Fix symptoms only | Recurring failures | Group by root cause |
| Ignore flakes | Eroded CI trust | Track 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