一键导入
analyze-ci
Analyze CI failures by fetching logs and producing a structured fix plan. Use before attempting automated CI fixes.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Analyze CI failures by fetching logs and producing a structured fix plan. Use before attempting automated CI fixes.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Produce a concrete implementation plan for a standalone Task or Epic takeover ticket. Use when a Jira Task/Epic is approved for Task Takeover planning and needs target files, implementation steps, tests, and repository scope.
Read-only qualitative review for Task Takeover implementations before PR creation. Use after task takeover execution completes.
Decompose a Technical Specification into implementable Epics with technical plans. Use when asked to break down features, create epics, or plan implementation.
Break down Epic implementation plans into concrete, actionable Tasks. Use when decomposing Epics into implementation units.
Implement code changes according to Task specifications. Use when executing implementation Tasks.
Produce a concrete implementation plan for a bug fix from an approved RCA and selected fix approach. Use when the team has selected a fix option and needs a detailed plan before implementation.
| name | analyze-ci |
| description | Analyze CI failures by fetching logs and producing a structured fix plan. Use before attempting automated CI fixes. |
You are given a list of failed CI checks with their log URLs. Fetch the actual logs, understand the root cause of each failure, and produce a structured fix plan for a developer agent to follow.
Before downloading any logs, check whether a previous fix attempt already ran:
If .forge/fix-plan.md exists, read it in full. Identify:
Run git log --oneline -10 to see what changes were committed by previous fix attempts. This tells you what code was already modified.
For each test that is still failing in the current run:
For each test that is no longer failing: it was fixed. Do not include it in this plan.
If this is a retry (attempt > 1) and a test is still failing despite a prior fix:
git diff HEAD~3..HEAD and reconsider whether it actually addresses the failure mode.Read the failures file at the path provided in the prompt using read_file
Create .forge/logs/ in the workspace if it doesn't exist: mkdir -p .forge/logs
For each failed check that has a log URL, download to .forge/logs/ first — one download, then analyze locally:
Single log file (GitHub Actions, plain Prow log URL):
gh api repos/{owner}/{repo}/actions/jobs/{job-id}/logs > .forge/logs/{check-name}.txtcurl -sL "{url}" -o .forge/logs/{check-name}.txtLog bundle / archive (Prow often uploads a .tar.gz bundle of all logs):
curl -sL "{url}" -o .forge/logs/{check-name}.tar.gztar -xzf .forge/logs/{check-name}.tar.gz -C .forge/logs/{check-name}/build-log.txt, controller logs, and test outputGitHub Actions artifacts (uploaded on failure):
gh run download {run-id} -n {artifact-name} -D .forge/logs/{check-name}/Analyze the downloaded files using local tools — use your judgment:
grep -i "error\|fail\|panic\|FAIL" .forge/logs/{check-name}.txt | tail -50tail -100 .forge/logs/{check-name}/build-log.txtCategorize each failure (see categories below)
For fixable failures, determine exactly what needs to change
Write the fix plan to .forge/fix-plan.md in the workspace (see output format)
Important: Do not print large log content to the conversation. Analyse locally and write only the structured fix plan to the output file.
gofmt, ruff, etc.). Fix: run the formatter on the affected files.Before marking any e2e failure as skipped, apply these checks:
Failure rate: Does the same test fail in ≥70% of runs across multiple environments? High, consistent failure rates indicate a code bug, not a flaky environment. A test that fails 3 out of 4 runs with the same error is almost certainly a code bug.
Error consistency: Is the same assertion failing with the same error message across runs and environments? Consistent errors point to code; varied errors (different steps, timeouts vs. assertion mismatches) point to infrastructure or true flakiness.
Error type: Does the failure message mention assertion mismatches on computed values (condition status, timestamps, counts) vs. infrastructure errors (connection refused, resource not found in OpenStack, DevStack not ready)?
Failure isolation: Does the failure happen at a specific, named test step that exercises business logic, rather than during setup/teardown or cluster bootstrapping?
If any of these checks points to a code defect, classify as e2e-code-bug and investigate the implementation, not the test harness. Read the relevant source code to confirm the root cause before writing the fix plan.
When a test measures time-based behavior (resyncs, requeues, reconcile periods, backoff timers), apply these additional checks before concluding it is environment load:
Stuck vs slow: A slow operation makes progress but takes longer than the timeout. A stuck operation never makes progress at all. Check the logs:
lastSyncTime, status.id) changes at least once during the timeout window → the system is slow, a timeout increase may be appropriate.To confirm stuck vs slow: search the logs for the field name and check whether its value ever changes between test start and assertion failure. If it does not change at all, the controller never scheduled a follow-up reconcile.
Probabilistic code bugs: Not all code bugs fail 100% of the time. A bug that triggers with ~50% probability per resource will fail:
When related tests that exercise the same code path show inconsistent failure rates, compute the per-resource failure probability. If it is consistent across tests (e.g. all explained by ~50% per resource), that is a single probabilistic code bug, not independent flakes. Treat it as an e2e-code-bug and read the source code.
Read the source code for timing failures: For any failure involving timing, scheduling, or state machine transitions, read the relevant controller/handler code before drawing conclusions. Look for: early-return paths that skip scheduling a follow-up requeue, race conditions between jitter and period checks, or conditions that prevent the next reconcile from being registered. A timeout increase is only valid if you have read the code and confirmed the operation can complete correctly. If any code path prevents the operation from ever completing, that is a code bug.
Never propose a timeout increase as the sole fix without first verifying via source code that the operation is capable of completing. Timeout increases mask stuck states and leave the underlying bug unresolved.
Write the fix plan to .forge/fix-plan.md in this exact structure so the fix agent can follow it mechanically:
# CI Fix Plan
## Summary
[1-2 sentences: what failed and what the fix involves]
## Fixable Failures
### [check-name]
**Category**: [codegen-outdated | format | lint | compile | unit-test]
**Root Cause**: [exact error message or description]
**Affected Files**: [list of files to change]
**Fix**:
1. [exact command or edit to apply]
2. [verification command to confirm fix]
### [next check-name]
...
## Skipped Failures
### [check-name]
**Reason**: [e2e-infra | infra | flaky] — [brief explanation]
### [next check-name]
...
go:generate directive or script to runFor every fixable failure that changes a constant, threshold, algorithm, or behavior, search the repository for stale documentation before writing the fix plan:
grep -r "<old value>" . --include="*.go" --include="*.md" -l
Include any files with stale references in Affected Files alongside the implementation files. The fix agent will update them as part of the same commit.
Examples of what to search for:
Do not skip this step just because the stale references are in documentation rather than code — documentation that contradicts the implementation is a bug.