fix-ci-failures
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "fix-ci-failures":https://skillpi.com/zh/skills/deepskill-fdeef1e97e02f195aec4c2fd9d3b552b9fe1aeb7c472315ab1544b856b109756。安装前核对上游来源和版本:https://skills.sh/microsoft/vscode/fix-ci-failures。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
skills.sh
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
调查并修复拉取请求中的 CI 失败。用于当 PR 分支上的 CI 检查失败时,包括查找 PR、识别失败检查、下载日志与构件、提取失败原因并迭代修复(需要使用 gh CLI)。
介绍来源: third_party · microsoft · 1.0.0 参考来源
SkillPi 解读
- 能完成的任务
- 翻译待完成,请参阅来源文档。
- 输入和输出
- 翻译待完成,请参阅来源文档。
- 实测状态
- 未测试
文件浏览
Frontmatter
name: fix-ci-failures
description: Investigate and fix CI failures on a pull request. Use when CI checks fail on a PR branch — covers finding the PR, identifying failed checks, downloading logs and artifacts, extracting the failure cause, and iterating on a fix. Requires the `gh` CLI.Investigating and Fixing CI Failures
This skill guides you through diagnosing and fixing CI failures on a PR using the gh CLI. The user has the PR branch checked out locally.
Workflow Overview
- Identify the current branch and its PR
- Check CI status and find failed checks
- Download logs for failed jobs
- Extract and understand the failure
- Fix the issue and push
Step 1: Identify the Branch and PR
# Get the current branch name
git branch --show-current
# Find the PR for this branch
gh pr view --json number,title,url,statusCheckRollup
If no PR is found, the user may need to specify the PR number.
Step 2: Check CI Status
# List all checks and their status (pass/fail/pending)
gh pr checks --json name,state,link,bucket
# Filter to only failed checks
gh pr checks --json name,state,link,bucket --jq '.[] | select(.bucket == "fail")'
The link field contains the URL to the GitHub Actions job. Extract the run ID from the URL — it's the number after /runs/:
https://github.com/microsoft/vscode/actions/runs/<RUN_ID>/job/<JOB_ID>
If checks are still IN_PROGRESS, wait for them to complete before downloading logs:
gh pr checks --watch --fail-fast
Step 3: Get Failed Job Details
# List failed jobs in a run (use the run ID from the check link)
gh run view <RUN_ID> --json jobs --jq '.jobs[] | select(.conclusion == "failure") | {name: .name, id: .databaseId}'
Step 4: Download Failure Logs
There are two approaches depending on the type of failure.
Option A: View Failed Step Logs Directly
Best for build/compile/lint failures where the error is in the step output:
# View only the failed step logs (most useful — shows just the errors)
gh run view <RUN_ID> --job <JOB_ID> --log-failed
Important:
--log-failedrequires the entire run to complete, not just the failed job. If other jobs are still running, this command will block or error. Use Option C below to get logs for a completed job while the run is still in progress.
The output can be large. Pipe through tail or grep to focus:
# Last 100 lines of failed output
gh run view <RUN_ID> --job <JOB_ID> --log-failed | tail -100
# Search for common error patterns
gh run view <RUN_ID> --job <JOB_ID> --log-failed | grep -E "Error|FAIL|error TS|AssertionError|failing"
Option B: Download Artifacts
Best for integration test failures where detailed logs (terminal logs, ext host logs, crash dumps) are uploaded as artifacts:
# List available artifacts for a run
gh run download <RUN_ID> --pattern '*' --dir /dev/null 2>&1 || gh run view <RUN_ID> --json jobs --jq '.jobs[].name'
# Download log artifacts for a specific failed job
# Artifact naming convention: logs-<platform>-<arch>-<test-type>-<attempt>
# Examples: logs-linux-x64-electron-1, logs-linux-x64-remote-1
gh run download <RUN_ID> -n "logs-linux-x64-electron-1" -D /tmp/ci-logs
# Download crash dumps if available
gh run download <RUN_ID> -n "crash-dump-linux-x64-electron-1" -D /tmp/ci-crashes
Tip: Use the test runner name from the failed check (e.g., "Linux / Electron" →
electron, "Linux / Remote" →remote) and platform map ("Windows" →windows-x64, "Linux" →linux-x64, "macOS" →macos-arm64) to construct the artifact name.
Warning: Log artifacts may be empty if the test runner crashed before producing output (e.g., Electron download failure). In that case, fall back to Option C.
Option C: Download Per-Job Logs via API (works while run is in progress)
When the run is still in progress but the failed job has completed, use the GitHub API to download that job's step logs directly:
# Save the full job log to a temp file (can be very large — 30k+ lines)
gh api repos/microsoft/vscode/actions/jobs/<JOB_ID>/logs > "$TMPDIR/ci-job-log.txt"
Then search the saved file. Start with ##[error] — this is the GitHub Actions error annotation that marks the exact line where the step failed:
# Step 1: Find the error annotation (fastest path to the failure)
grep -n '##\[error\]' "$TMPDIR/ci-job-log.txt"
# Step 2: Read context around the error (e.g., if error is on line 34371, read 200 lines before it)
sed -n '34171,34371p' "$TMPDIR/ci-job-log.txt"
If ##[error] doesn't reveal enough, use broader patterns:
# Find test failures, exceptions, and crash indicators
grep -n -E 'HTTPError|ECONNRESET|ETIMEDOUT|502|exit code|Process completed|node:internal|triggerUncaughtException' "$TMPDIR/ci-job-log.txt" | head -20
Why save to a file? The API response for a full job log can be 30k+ lines. Tool output gets truncated, so always redirect to a file first, then search.
VS Code Log Artifacts Structure
Downloaded log artifacts typically contain:
logs-linux-x64-electron-1/
main.log # Main process log
terminal.log # Terminal/pty host log (key for run_in_terminal issues)
window1/
renderer.log # Renderer process log
exthost/
exthost.log # Extension host log (key for extension test failures)
Key files to examine first:
- Test assertion failures: Check
exthost.logfor the extension host output and stack traces - Terminal/sandbox issues: Check
terminal.logfor rewriter pipeline, shell integration, and strategy logs - Crash/hang: Check
main.logand look for crash dumps artifacts
Step 5: Extract the Failure
For Test Failures
Look for the test runner output in the failed step log:
# Find failing test names and assertion messages
gh run view <RUN_ID> --job <JOB_ID> --log-failed | grep -A 5 "failing\|AssertionError\|Expected\|Unexpected"
Common patterns in VS Code CI:
AssertionError [ERR_ASSERTION]: Test assertion failed — check expected vs actual valuesExtension host test runner exit code: 1: Integration test suite had failuresCommand produced no output: Shell integration may not have captured command output (see terminal.log)Error: Timeout: Test timed out — could be a hang or slow CI machine
For Build Failures
# Find TypeScript compilation errors
gh run view <RUN_ID> --job <JOB_ID> --log-failed | grep "error TS"
# Find hygiene/lint errors
gh run view <RUN_ID> --job <JOB_ID> --log-failed | grep -E "eslint|stylelint|hygiene"
Step 6: Determine if Failures are Related to the PR
Before fixing, determine if the failure is caused by the PR changes or is a pre-existing/infrastructure issue:
- Check if the failing test is in code you changed — if the test is in a completely unrelated area, it may be a flake
- Check the test name — does it relate to the feature area you modified?
- Look at the failure output — does it reference code paths your PR touches?
- Check if the same tests fail on main — if identical failures exist on recent main commits, it's a pre-existing issue
- Look for infrastructure failures — network timeouts, npm registry errors, and machine-level issues are not caused by code changes
# Check recent runs on main for the same workflow
gh run list --branch main --workflow pr-linux-test.yml --limit 5 --json databaseId,conclusion,displayTitle
Recognizing Infrastructure / Flaky Failures
Not all CI failures are caused by code changes. Common infrastructure failures:
Network / Registry issues:
npm ERR! network,ETIMEDOUT,ECONNRESET,EAI_AGAIN— npm registry unreachableerror: RPC failed; curl 56,fetch-pack: unexpected disconnect— git network failureError: unable to get local issuer certificate— TLS/certificate issuesrate limit exceeded— GitHub API rate limitingHTTPError: Request failed with status code 502onelectron/electron/releases— Electron CDN download failure (common in thenode.js integration testsstep, which downloads Electron at runtime)
Machine / Environment issues:
No space left on device— CI disk fullENOMEM,JavaScript heap out of memory— CI machine ran out of memoryThe runner has received a shutdown signal— CI preemption / timeoutError: The operation was canceled— GitHub Actions cancelled the jobXvfb failed to start— display server for headless Linux tests failed
Test flakes (not infrastructure, but not your fault either):
- Timeouts on tests that normally pass — slow CI machine
- Race conditions in async tests
- Shell integration not reporting exit codes (see terminal.log for
exitCode: undefined)
What to do with infrastructure failures:
- Don't change code — the failure isn't caused by your PR
- Re-run the failed jobs via the GitHub UI or:
gh run rerun <RUN_ID> --failed - If failures persist across re-runs, check if main is also broken:
gh run list --branch main --limit 10 --json databaseId,conclusion,displayTitle - If main is broken too, wait for it to be fixed — your PR is not the cause
Step 7: Fix and Iterate
- Make the fix locally
- Verify compilation: check the
VS Code - Buildtask or runnpm run typecheck-client - Run relevant unit tests locally:
./scripts/test.sh --grep "<pattern>" - Commit and push:
git add -A git commit -m "fix: <description>" git push - Watch CI again:
gh pr checks --watch --fail-fast
Quick Reference
| Task | Command |
|---|---|
| Find PR for branch | gh pr view --json number,url |
| List all checks | gh pr checks --json name,state,bucket |
| List failed checks only | gh pr checks --json name,state,link,bucket --jq '.[] \| select(.bucket == "fail")' |
| Watch checks until done | gh pr checks --watch --fail-fast |
| Failed jobs in a run | gh run view <RUN_ID> --json jobs --jq '.jobs[] \| select(.conclusion == "failure") \| {name, id: .databaseId}' |
| View failed step logs | gh run view <RUN_ID> --job <JOB_ID> --log-failed (requires full run to complete) |
| Download job log via API | gh api repos/microsoft/vscode/actions/jobs/<JOB_ID>/logs > "$TMPDIR/ci-job-log.txt" (works while run is in progress) |
| Find error line in log | grep -n '##\[error\]' "$TMPDIR/ci-job-log.txt" |
| Download log artifacts | gh run download <RUN_ID> -n "<artifact-name>" -D /tmp/ci-logs |
| Re-run failed jobs | gh run rerun <RUN_ID> --failed |
| Recent main runs | gh run list --branch main --workflow <workflow>.yml --limit 5 |
当前收录版本
1.0.0
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 解决开发者高频刚需:修复 PR 的 CI 失败是日常开发中的核心痛点
- 提供端到端完整闭环:从识别 PR、下载日志、分析失败原因到修复迭代的完整工作流
- 显著提升效率:通过 gh CLI 自动化复杂的手动排查过程,节省大量时间
亮点
- 触发场景描述清晰:明确针对 PR 分支 CI 检查失败的场景
- 覆盖多种触发变体:包括查找 PR、识别失败检查、下载日志等子任务
- 边界定义明确:限定使用 gh CLI 且用户已检出 PR 分支
待提升项
-
缺少 When to Use 显式章节 原报告严重程度:轻微
文档中未设置显式的 When to Use 章节,但 description 字段已充分描述使用场景
改进建议:建议在正文开头添加 When to Use 章节以增强可读性
亮点
- 步骤划分清晰:7 个主要步骤逻辑连贯,每个步骤有明确目标和出口条件
- 示例完整:提供大量具体命令示例和实际输出片段
- 结构规范:frontmatter 完整,代码块格式正确,表格清晰
亮点
- 工具来源明确:全程使用官方 gh CLI 工具,参数准确
- 异常处理完善:覆盖网络错误、超时、机器问题等常见基础设施故障
- 安全机制健全:区分代码问题与基础设施问题,避免误改代码
- 提供重试机制:支持重新运行失败任务以排除偶发问题
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。
文档引用的域名或地址
这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。
- github.com
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。