Skip to content
ci-job-analysis logo

CI Job 分析知识库

ci-job-analysis

CI Job 失败分析知识库,包含失败类型分类、置信度评估、技术栈识别和常见错误模式

SKILL.md

Full skill instructions

CI Job 分析知识库

本知识库提供 GitHub Actions Job 失败分析和修复的专业知识。

失败类型分类体系

1. 测试失败 (test_failure)

子类型频率关键信号可自动修复
unit_test45%pytest FAILED, jest FAIL, vitest是
integration_test30%integration, api test, mock server是
snapshot_test15%snapshot, toMatchSnapshot是
other_test10%其他测试框架部分

注意:频率数据基于历史统计,总和为 100%。

常见根因:

  1. Mock 数据不完整:测试 mock 缺少新增字段
  2. API 契约变更:接口返回格式改变
  3. 异步时序问题:await 缺失或时序错误
  4. 环境差异:CI 环境与本地环境不一致

修复策略:

1. 定位失败测试和断言
2. 比较期望值 vs 实际值
3. 追踪数据流到源头
4. 更新 mock 或修复断言
5. 验证修复

2. E2E 失败 (e2e_failure)

子类型频率关键信号可自动修复
timeout35%Timeout, 30000ms, waiting for是
selector30%strict mode, not found, resolved to是
assertion20%expect().toHave, toBeVisible是
network15%Route handler, net::ERR部分

常见根因:

  1. 选择器过时:UI 变更导致选择器失效
  2. 加载时序:页面加载慢导致超时
  3. 网络拦截失效:API mock 未正确配置
  4. 状态污染:测试之间状态未隔离

修复策略:

1. 分析超时/选择器错误的具体位置
2. 检查 UI 是否变更
3. 添加适当的等待策略
4. 更新选择器或断言

3. 构建失败 (build_failure)

子类型频率关键信号可自动修复
typescript45%tsc, error TS, compile部分
webpack20%webpack, Module not found部分
python20%SyntaxError, ModuleNotFound部分
other15%build failed, make error否

常见根因:

  1. 类型不匹配:TypeScript 类型错误
  2. 缺失依赖:import 的模块不存在
  3. 语法错误:代码语法问题
  4. 配置错误:构建配置不正确

4. Lint 失败 (lint_failure)

子类型频率关键信号可自动修复
eslint50%eslint, @typescript-eslint是
ruff25%ruff, E501, W503是
prettier20%prettier, formatting是
other5%mypy, pylint部分

快速修复路径:

# ESLint
npx eslint --fix {files}

# Ruff
ruff check --fix {files}

# Prettier
npx prettier --write {files}

5. 类型检查失败 (type_check_failure)

子类型频率关键信号可自动修复
typescript70%tsc --noEmit, error TS部分
mypy30%mypy, type: ignore部分

常见错误类型:

错误码描述自动修复
TS2345参数类型不匹配否
TS2322类型赋值错误否
TS2339属性不存在否
TS7006隐式 any是

6. 依赖失败 (dependency_failure)

子类型频率关键信号可自动修复
npm40%npm install, ERESOLVE否
pip35%pip install, requirement否
yarn15%yarn, resolution否
other10%pnpm, poetry否

常见问题:

  1. 版本冲突
  2. 私有包认证失败
  3. 网络问题
  4. 锁文件过时

建议:依赖问题通常需要手动处理,因为涉及版本策略决策。

7. 配置失败 (config_failure)

子类型频率关键信号可自动修复
env50%env, secret, KEY_ERROR否
permission30%permission denied, 403否
config_file20%config, settings否

不可自动修复原因:涉及敏感信息和权限配置,需要人工处理。

8. 基础设施失败 (infrastructure_failure)

子类型频率关键信号可自动修复
runner40%runner, self-hosted否
resource35%OOM, killed, disk否
network25%network, timeout否

不可自动修复原因:涉及 CI 基础设施,需要运维处理。


置信度评估体系

评分因素

因素权重描述
信号明确性40%错误信号是否清晰明确
文件定位30%是否能定位到具体文件和行号
模式匹配20%是否匹配已知错误模式
上下文完整10%是否有完整的堆栈追踪

置信度阈值

分数级别行为
>= 80高自动修复
60-79中询问用户后修复
40-59低展示分析,建议手动
< 40极低跳过

置信度调整规则

提升条件:

  • 找到高相似度历史案例:+10
  • 完整的堆栈追踪:+5
  • 明确的代码变更点:+5
  • 匹配已知错误模式:+5

降低条件:

  • 涉及多个不相关文件:-10
  • 错误消息模糊:-10
  • 无法定位具体原因:-15
  • 可能涉及配置/权限:-20

技术栈识别

基于文件路径

backend:
  patterns:
    - "**/​*.py"
    - "tests/​backend/​**"
    - "tests/​unit/​**"
    - "src/​api/​**"
    - "app/​**"
  signals:
    - "pytest"
    - "FastAPI"
    - "Django"
    - "Python"

frontend:
  patterns:
    - "**/​*.tsx"
    - "**/​*.jsx"
    - "**/​*.ts"
    - "tests/​frontend/​**"
    - "src/​components/​**"
  signals:
    - "jest"
    - "vitest"
    - "React"
    - "Vue"

e2e:
  patterns:
    - "e2e/​**"
    - "tests/​e2e/​**"
    - "playwright/​**"
    - "cypress/​**"
  signals:
    - "playwright"
    - "cypress"
    - "puppeteer"

混合技术栈处理

当检测到多个技术栈时:

  1. 按错误数量确定主要技术栈
  2. 次要技术栈作为 secondary_stack
  3. 优先处理主要技术栈的错误

常见错误模式库

pytest 错误模式

# 断言失败
FAILED tests/​test_xxx.py::test_name - AssertionError: assert X == Y

# 异常未捕获
FAILED tests/​test_xxx.py::test_name - ExceptionType: message

# fixture 错误
ERROR tests/​test_xxx.py::test_name - fixture 'xxx' not found

# 导入错误
ERROR tests/​test_xxx.py - ModuleNotFoundError: No module named 'xxx'

jest/​vitest 错误模式

# 断言失败
FAIL src/​xxx.test.ts
  ✕ test name (123ms)
    expect(received).toBe(expected)

# 超时
FAIL src/​xxx.test.ts
  ✕ test name (5001ms)
    Timeout - Async callback was not invoked within 5000ms

# 快照失败
FAIL src/​xxx.test.ts
  ✕ test name
    expect(received).toMatchSnapshot()

playwright 错误模式

# 超时
Error: locator.click: Timeout 30000ms exceeded.
waiting for locator('selector')

# 选择器问题
Error: locator.click: Error: strict mode violation:
locator('selector') resolved to 2 elements

# 断言失败
Error: expect(locator).toBeVisible()
Locator expected to be visible

TypeScript 错误模式

# 类型不匹配
error TS2345: Argument of type 'X' is not assignable to parameter of type 'Y'

# 属性不存在
error TS2339: Property 'xxx' does not exist on type 'Y'

# 隐式 any
error TS7006: Parameter 'xxx' implicitly has an 'any' type

修复工作流映射

失败类型修复方式关联工作流
test_failure (backend)bugfix_workflow/​fix-backend
test_failure (frontend)bugfix_workflow/​fix-frontend
e2e_failurebugfix_workflow/​fix-e2e
lint_failurequick_fix直接运行 lint --fix
type_check_failurebugfix_workflow对应栈工作流
build_failurebugfix_workflow对应栈工作流
dependency_failuremanual无
config_failuremanual无
infrastructure_failuremanual无

历史案例匹配

相似度计算

def calculate_similarity(current, historical):
    score = 0

    # 错误类型匹配 (30%)
    if current.failure_type == historical.failure_type:
        score += 30

    # 文件路径匹配 (25%)
    file_overlap = len(set(current.files) & set(historical.files))
    score += min(25, file_overlap * 5)

    # 错误消息相似 (25%)
    message_similarity = text_similarity(current.error, historical.error)
    score += message_similarity * 25

    # 修复模式相似 (20%)
    if current.suggested_fix_type == historical.fix_type:
        score += 20

    return score

高价值案例特征

值得记录为历史案例的修复:

  1. 置信度 >= 80
  2. 修复成功
  3. 有明确的根因分析
  4. 包含可复用的修复方法
  5. 涉及常见错误模式

More DevOps & CI/CD skills

Project scaffolding, deployment configuration, and CI/CD setup for Google ADK agents.

6K 472.6K
View

Set up tracing, logging, and monitoring for deployed ADK agents across Cloud Trace, BigQuery, and third-party platforms.

6K 472.6K
View

Enterprise Azure infrastructure architect generating Bicep or Terraform from workload descriptions.

1.5K 454.3K
View
azure-kubernetes logo
DevOps & CI/CD

azure-kubernetes

Plan and configure production-ready Azure Kubernetes Service clusters with Day-0 and Day-1 best practices.

1.5K 447.1K
View

Raw mechanical interfaces fusing Swiss typographic print with military terminal aesthetics. Rigid grids, extreme type scale contrast, utilitarian color, analog degradation effects. For data-heavy dashboards, portfolios, or editorial sites that need to feel like declassified blueprints.

92.7K 354.9K
View
just-scrape logo
DevOps & CI/CD

just-scrape

Web search, scraping, extraction, crawling, and monitoring via ScrapeGraph AI CLI.

69 245K
View

Skill for working with Firebase Hosting (Classic). Use this when you want to deploy static web apps, Single Page Apps (SPAs), or simple microservices. Do NOT use for Firebase App Hosting.

462 159.7K
View

Deploy and manage web apps with Firebase App Hosting. Use this skill when deploying Next.js/Angular apps with backends.

462 159.1K
View
deploy-to-vercel logo
DevOps & CI/CD

deploy-to-vercel

Deploy applications and websites to Vercel. Use when the user requests deployment actions like "deploy my app", "deploy and give me the link", "push this live", or "create a preview deployment".

31.9K 146.6K
View
programmatic-seo logo
DevOps & CI/CD

programmatic-seo

Build SEO-optimized pages at scale using templates, data, and proven playbook patterns.

53.3K 140.1K
View

Design and build isolated, reusable Convex backend components with clear boundaries and app-facing wrappers.

63 123.5K
View

Deploy and manage projects on Vercel using token-based authentication. Use when working with Vercel CLI using access tokens rather than interactive login — e.g. "deploy to vercel", "set up vercel", "add environment variables to vercel".

31.9K 116.1K
View

Coding & apps AI tools

Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View
Imagica logo
Coding & apps

Imagica

Build a no-code AI app in minutes.

Freemium
View
E
Coding & apps

Emergent.sh

An IDE for code migration from legacy to modern frameworks through coding agents.

Freemium
View
Wonder Dynamics logo
Coding & apps

Wonder Dynamics

Automate CGI animation in live-action scenes

Paid
View
M
Coding & apps

Mixo

Launch a website in seconds with AI.

Paid
View
AI Code Convert logo
Coding & apps

AI Code Convert

Streamline Your Coding Experience with AI Code Helper

Free
View