Ci triage

From shogo-labs/shogo-ai · View interactive version

Ci triage is an AI agent skill from the GitHub repository shogo-labs/shogo-ai. Classify and triage CI/CD pipeline failures — regressions, flaky tests, infra issues

How to use this skill

Skill file

CI Failure Triage

Systematically diagnose CI/CD failures and classify them by root cause.

Triage Workflow

1. Connect to CI Provider

2. Pull Failure Logs

3. Classify Root Cause

| Category | Signals | Action |

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

| Real regression | Test was passing in previous runs, now fails consistently | Identify the failing assertion. Correlate with recent commits via git log. Suggest which change caused it. |

| Flaky test | Test has flipped pass/fail in recent history (check memory) | Check memory for flip count. If 3+ flips in 7 days → confirmed flaky. Suggest stabilization. |

| Environment issue | Timeout errors, connection refused, DNS resolution, missing env vars | Not a code problem. Suggest retry, check infra, verify env configuration. |

| Dependency issue | npm install fails, version conflicts, breaking changes in packages | Check package-lock.json changes. Suggest pinning versions or updating. |

| Build error | TypeScript errors, lint failures, compilation errors | Not a test failure. Point to the exact file/line with the error. |

4. Check Memory for History

5. Suggest Action

For real regressions:

  1. Identify the exact assertion that fails
  2. Find the most recent commit that touched the relevant file
  3. Suggest: "This test started failing after commit abc123 which changed src/auth.ts"
  4. Recommend: fix the code or update the test if behavior intentionally changed

For flaky tests:

  1. Show flip history from memory
  2. Common stabilization strategies:
  1. If stabilization isn't feasible: suggest quarantining the test

For environment issues:

  1. Check if the issue is transient (retry the build)
  2. If persistent: check CI runner config, env vars, service health
  3. Common fixes: restart CI runner, clear cache, update base image

For dependency issues:

  1. Check if package-lock.json or yarn.lock changed recently
  2. Check if a dependency released a breaking change
  3. Suggest: pin to last known working version, then investigate upgrade path

Flaky Test Detection

A test is flaky if it meets any of these criteria:

Flaky Test Memory Schema

{
  "testName": "login flow should redirect to dashboard",
  "file": "tests/auth.spec.ts",
  "flipHistory": [
    { "date": "2024-01-15", "result": "fail", "ci_run": "12345" },
    { "date": "2024-01-15", "result": "pass", "ci_run": "12346" },
    { "date": "2024-01-16", "result": "fail", "ci_run": "12350" }
  ],
  "flipCount7d": 3,
  "status": "flaky",
  "lastStabilizationAttempt": null
}

Reporting Format

When presenting triage results:

## CI Triage Report — Build #12345

**Status:** ❌ Failed
**Failed at:** Test step — `npm run test:e2e`
**Duration:** 4m 32s

### Failures (2)

1. **`auth.spec.ts` → "should redirect after login"**
   - Classification: 🔴 Real Regression
   - Assertion: `Expected URL to contain '/dashboard', got '/login'`
   - Likely cause: Commit `abc123` changed the auth redirect logic
   - Suggested fix: Check `src/middleware/auth.ts` line 42

2. **`checkout.spec.ts` → "should calculate tax"**
   - Classification: 🟡 Flaky (seen 4x in 7 days)
   - Flip history: pass → fail → pass → fail
   - Suggested fix: Replace `waitForTimeout(2000)` with `waitForSelector('.total-amount')`

### Passing (47/49)

Proactive Monitoring

During heartbeat cycles:

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.