investigating-ci-failures
하는 일
이 스킬은 실패한 테스트 하나나 빨간 CI 실행 하나를 받아, 내 변경 때문인지, 공유된 main 브랜치 때문인지, 불안정한 테스트 때문인지 알아냅니다. 다음에 누가 조치해야 하는지 알고 싶은 개발자를 위한 것입니다.
사용하는 경우
- ✓테스트가 CI에서 계속 실패해서 불안정한 것인지 정말 깨진 것인지 알고 싶을 때.
- ✓누가 main 브랜치를 깨뜨렸는지 묻는데 커밋과 작성자가 필요할 때.
- ✓CI 실패가 언제 시작되었는지, 그리고 수정이 이미 들어갔는지 알고 싶을 때.
스킬 링크
https://github.com/PostHog/posthog/blob/master/products/engineering_analytics/skills/investigating-ci-failures/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“이 테스트가 CI에서 왜 실패했나요? 제 풀 리퀘스트가 원인인가요, 아니면 master에서 이미 깨져 있었나요?”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
저장된 CI 실패 기록과 작업 기록을 검색하는데, 여기에는 각 커밋과 작성자가 나옵니다. 그다음 실패가 시작된 시점을 변경과 맞추고, CI를 다시 실행하지 않고 수정이 있는지 확인합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Investigating CI failures
The job: take one failing test or one red run and get to a verdict a developer can act on — yours / trunk-borne / flaky, and when trunk-borne: the culprit SHA, its author, the PR, and whether a fix already landed. Everything below is derivation over data that already exists; you never need to re-run CI to answer.
Two warehouse views are the substrate (both non-materialized — always current, query them freely):
engineering_analytics_ci_failures— one row per pytestFAILED <nodeid>line from CI logs, pre-fingerprinted (fingerprint= test id + digit/hex-normalized error). Group byfingerprintto get first/last seen, occurrence count, and branch spread.engineering_analytics_ci_job_history— one row per job attempt withconclusionAND commit attribution:head_sha,commit_author_name,commit_message,commit_pr_number(the merged PR that produced the commit, the only PR attribution a master push run has). This is where greens live; the logs are failure-only, so every "when did it turn red / green again" question must come from here, never from the logs.
Copy-ready SQL for every step is in references/investigation-queries.md.
Start wide: what's broken right now
For "what CI failures should I care about right now" (before you have a specific test in hand), the
engineering-analytics-broken-tests MCP tool does the shape classification below across all live
failures at once: it groups the last 2 days of failures by fingerprint and labels each
breaking_master / blocking_merge_queue / novel_burst / potentially_resolved / flaky /
pr_only, most urgent first, plus breaking_master_jobs (default-branch jobs whose latest run is
red). Use it as the triage entry point, then drop into the per-failure workflow below to reach a
culprit. It is the automated counterpart to fingerprinting by hand; the manual queries stay the way
to pin a specific failure to a boundary and author.
blocking_merge_queue is the one shape the manual table below does not cover, because it looks like
a single-branch failure and is not. The merge queue runs the full suite on a gate branch
(trunk-merge/pr-<n>/…) carrying master, the PR, and every PR queued ahead of it with overlapping
impacted targets (in practice most of the queue), so a failure there is on a commit that already
passed the PR's own CI: a conflict with what landed or queued in between, or a queue-mate's own
break, not that PR's bug by default. Read it as "this stopped a merge", list what the gate branch
ran (query 8), and diff it against trunk rather than reading the PR alone.
The four failure shapes
Fingerprint the failure first (query 1 in the references), then read its shape — the classification falls out of three columns:
| Shape | Reading | Next step |
|---|---|---|
| 1 branch, any window | That PR's own problem | Read its failure lines; done |
1 trunk-merge/pr-<n>/… gate branch |
Queue-mate, or landed since | Query 8, then diff the gate branch against trunk |
| Many branches, dense burst, hits master | Trunk break (master is/was red) | Boundary query → culprit (below) |
| Many branches, sporadic over days/weeks | Flaky | Corroborate with engineering-analytics-flaky-tests |
Why cross-branch means trunk: PR CI runs the PR merged with master, so one bad master commit fails every concurrently-running PR. A failure appearing on many unrelated branches in a tight window is the signature of a master-merge break, not of those PRs' code. Tell the asker explicitly when their PR is not at fault — that is usually the single most valuable sentence in the answer.
Trunk break → culprit
Run the boundary query (query 2): master-only job history for the failing job, ordered by
created_at. The pattern reads directly:
... success success | failure failure ... failure | success ...
^ first red = the culprit row ^ first green = the fix row
The culprit row carries everything: head_sha, commit_author_name, commit_message (which names
what changed), commit_pr_number. The first-green row
자주 묻는 질문
CI 작업을 다시 실행하나요?
아니요. 답은 이미 있는 데이터에서 나오므로 아무것도 다시 실행하지 않습니다.
불안정한 테스트란 무엇인가요?
어떤 실행에서는 실패하고 다른 실행에서는 통과하는 테스트입니다. 스킬은 같은 오류를 보이는 반복 실패를 묶습니다.
master를 누가 깼는지 찾을 수 있나요?
네. 실패를 시작시킨 커밋, 그 작성자, 그것이 나온 풀 리퀘스트를 식별합니다.
상세 정보
작성자의 원본 설명
Investigates a specific CI failure to a verdict: whose fault, which commit, who wrote it, and whether it's fixed. Use for "who broke master", "why did this test fail in CI", "is this failure my PR's fault or everyone's", "is this test flaky or actually broken", "when did this failure start". Works from the engineering_analytics warehouse views (engineering_analytics_ci_failures, engineering_analytics_ci_job_history) plus the CI failure logs. Not for aggregate CI health, cost, or merge bottlenecks (use diagnosing-ci-and-merge-bottlenecks) and not for building saved insights (use turning-enginee
repo: PostHog/posthog
인기도
- GitHub 스타
- 41k
- 순위
- #6865
- 라이선스
- —
- 업데이트
- 2026. 11. 2.
댓글
- …
이 저장소의 다른 스킬
depot-ci
41k에이전트가 GitHub Actions 대안인 Depot CI 워크플로를 설정하고 실행하도록 돕습니다. 기존 워크플로 이전과 실행 로그 읽기를 포함합니다.
depot-container-builds
41k에이전트가 Depot 원격 빌더에서 Docker 이미지를 빌드하도록 돕습니다. 다중 플랫폼 이미지, 레지스트리 푸시, 빌드 실패 수정을 포함합니다.
depot-github-runners
41k에이전트가 GitHub Actions 작업을 Depot 관리형 러너로 옮기고, 러너 크기와 라벨을 고르도록 돕습니다.
editing-agents-md
41k에이전트가 규칙을 AGENTS.md나 CLAUDE.md 중 어디에 둘지 정하고, 파일을 키우지 않으면서 잘 지켜지도록 쓰게 돕습니다.
비슷한 스킬
test-driven-development
311k에이전트가 기능이나 수정을 만들기 전에 실패하는 테스트를 먼저 쓰고, 그것을 통과시키는 가장 작은 코드를 작성하도록 가르칩니다.
verification-before-completion
311k에이전트가 작업, 수정, 빌드가 완료되었거나 통과했다고 말하기 전에 실제 점검을 실행하고 결과를 읽도록 가르칩니다.
migrate-to-shoehorn
310k테스트 파일의 위험한 타입 캐스팅을 shoehorn 라이브러리로 바꿔, 테스트가 일부 데이터만 써도 타입 검사를 통과하도록 돕습니다.