Diagnose Ci Failures

作者 warpdotdev2a03b403b4f8無授權條款收錄於 2026年10月8日更新於 2026年10月8日

Diagnose CI failures for a PR using the GitHub CLI, extract error logs, and generate a plan to fix them. Use when the user asks to check CI status, pull CI issues, triage test failures, or investigate PR build failures.

AI 產生的概覽

透過 GitHub CLI 診斷提取請求的 CI 失敗,並產生修正計畫。

功能
此技能定義了一套排查提取請求 CI 失敗的分步流程。它會檢查目前分支是否有 PR、讀取 CI 檢查狀態、用 GitHub CLI 拉取失敗執行的記錄,並把錯誤歸類為格式、lint、編譯、測試與平台相關等類型。其產出是一份計畫文件,包含問題說明、目前狀態、建議變更與驗證步驟,而不是程式碼變更。
適用情境
當使用者要求查看 CI 狀態、拉取 CI 問題、分診測試失敗,或排查提取請求的建置失敗時使用。它用於在動手修正之前進行診斷與規劃。
執行需求
需要已針對該儲存庫完成驗證的 GitHub CLI(gh)、用於讀取目前分支的 git,以及連線至 GitHub 的網路存取。它也會引用 create_plan 工具,以及 create-pr 與 fix-errors 技能。此技能不附帶指令碼,僅為說明文件。

diagnose-ci-failures

Programmatically diagnose CI failures for a PR and generate a plan to fix them.

Overview

This skill provides a deterministic workflow to check CI status for a PR, extract failure logs, analyze errors, and create a plan (not code changes) to resolve issues. The output is always a plan document that can be reviewed before execution.

Workflow

1. Verify PR exists for current branch

Get the current branch and check if a PR exists:

bash
# Get current branchgit branch --show-current
# Check for PRGH_PAGER=cat gh pr view <branch-name> --json number,title,url,state

If no PR exists, inform the user and offer to create one using the create-pr skill.

2. Check CI status

Fetch the status of all CI checks:

bash
GH_PAGER=cat gh pr view <branch-name> --json statusCheckRollup

Parse the output to identify:

  • Completed checks vs. in-progress checks
  • Successful checks
  • Failed checks with their names and details URLs

If CI is still running, inform the user which checks have already failed or passed, highlight the checks that are still running, and suggest waiting for completion before diagnosis.

3. Extract failure logs

For each failed check, pull the logs using the run ID from the status check:

bash
GH_PAGER=cat gh run view <run-id> --log-failed

Focus on extracting:

  • Error messages and their locations (file paths, line numbers)
  • Compilation errors (unused imports, type mismatches, etc.)
  • Linting/clippy errors with specific lint names
  • Test failure messages and stack traces
  • Build failures and their root causes

4. Categorize errors

Group errors by type:

  • Formatting issues: cargo fmt failures
  • Linting issues: cargo clippy warnings/errors
  • Compilation errors: Type errors, missing imports, signature mismatches
  • Test failures: Failing tests with their names and failure reasons
  • Platform-specific issues: WASM, Linux, macOS, Windows-specific failures

5. Generate fix plan

Create a plan document (using create_plan tool) with:

  • Problem Statement: Summary of failing checks
  • Current State: What errors were found and where
  • Proposed Changes: Specific fixes needed for each error category
  • Validation Steps: Commands to verify fixes (fmt, clippy, tests, presubmit)

The plan should reference the fix-errors skill for detailed guidance on resolving specific error types.

Important Notes

  • GitHub CLI paging: Set GH_PAGER=cat on every gh invocation. The GitHub CLI does not support --no-pager as a global option; GH_PAGER and PAGER are its documented paging controls
  • Always create a plan first: Never make code changes directly. Generate a plan for user review
  • Check test status in CI: Even if tests fail locally, verify they passed in CI before flagging as issues
  • Unrelated test failures: If tests passed in CI but fail locally, they may be environment-specific or flaky
  • Multiple error types: Fix one category at a time (e.g., all clippy errors before tests)
  • Cross-reference fix-errors skill: For detailed error resolution strategies, use the fix-errors skill

Common CI Check Names

  • Formatting + Clippy (MacOS)
  • Formatting + Clippy (Linux)
  • Run MacOS tests
  • Run Linux tests
  • Run Windows tests
  • Check CI results (summary check)
  • WASM build

Example Commands

Get PR status with details:

bash
GH_PAGER=cat gh pr view --json number,title,state,statusCheckRollup

Get logs from specific failed run:

bash
GH_PAGER=cat gh run view 12345678 --log-failed

Check for specific error in logs:

bash
GH_PAGER=cat gh run view 12345678 --log-failed 2>&1 | grep -A 5 "error:"

來源與署名

來源:warpdotdev/common-skills位於.agents/skills/diagnose-ci-failures提交2a03b40

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架