AI Crash 上报三角分类:从堆栈到负责人一次到位

2026 最新:把 Crashlytics / Sentry 原始堆栈喂给 AI,拿到 3 行 triage 卡——严重级、归属区域、建议负责人。

Crashlytics 收件箱周末新增了 40 个 issue。大多是重复,三个真问题,一个在烧。修问题不是成本,成本是周一站会前花 45 分钟读堆栈对人。AI 干第一遍这件事很在行:读堆栈、定位区域、推荐负责人。

这个任务

把一份原始 crash log(Crashlytics、Sentry、Firebase)转成 3 行 triage 卡片:严重级、归属区域、建议负责人。一个 issue 一张卡,不废话。

什么时候适合让 AI 做

  • 你有现成的代码区域 map(“payments 在 /billing”、“auth 在 /session”)。
  • 团队有按区域划分的明确负责人,不是”全员负责”。
  • 你能贴顶帧和往下 5-8 帧——而不是 1200 行完整 log。
  • 你愿意复核负责人推荐——AI 不懂团队政治。

要给 AI 喂什么

  • 顶帧 + 周围 5-8 帧
  • 首次出现的 App 版本
  • 受影响的会话/用户/设备数(Crashlytics 给什么就贴什么)
  • 代码区域 map:路径前缀 → 负责人
  • 严重级规则:什么算 P0、P1、P2
  • 与最近改动的关联(“4.2.0 重构了 auth”)

可直接复制的 Prompt

You are triaging an iOS crash for a 4-engineer team.

Stack (top 8 frames):
0  CRASH  __exceptionPreprocess
1         objc_exception_throw
2         -[NSDictionary getObjects:andKeys:count:]
3         -[BillingCoordinator _hydratePurchaseRecords:]  (BillingCoordinator.swift:218)
4         -[BillingCoordinator restorePurchases]  (BillingCoordinator.swift:74)
5         -[SettingsViewController didTapRestore:]  (SettingsViewController.swift:312)
6         UIControlEventInvocation
7         UIApplicationMain

First seen: app version 4.2.0 (current is 4.2.1).
Affected: 218 sessions across 41 users in the last 24 hours.
Device skew: 89% iPhone 14/15, 11% older.
iOS skew: 92% iOS 17+, 8% iOS 16.

Code-area map:
- /billing → owner: Sara
- /session → owner: Jin
- /ui → owner: Mei
- /core, /storage → owner: Ravi

Recent changes:
- 4.2.0 shipped a refactor of BillingCoordinator (Sara) — receipt parsing rewrite.
- 4.2.0 also bumped minimum iOS to 16.

Severity rubric:
- P0: crash-on-launch OR more than 1% of sessions OR blocks revenue path.
- P1: revenue path or auth path, less than 1% of sessions.
- P2: non-blocking, less than 0.2% of sessions.
- P3: cosmetic / log-only.

Output: a 3-line triage card.

Line 1: Severity + one-sentence summary of what crashed.
Line 2: Area (which file / subsystem) + suggested owner + WHY them.
Line 3: First debug step they should take, in one sentence. Be specific (file, line, method).

Rules:
- Do not invent line numbers I did not give you.
- If you cannot tell who the owner is from the area map, say "owner unclear" and propose Sara as escalation point.
- If the severity is ambiguous, default UP one level and explain.

示例输出

P1 — BillingCoordinator 在 restorePurchases 时崩溃;receipt 水合阶段在空/部分字典上强解或越界。 区域:/billing → 负责人 Sara。她在 4.2.0 重写了 receipt 解析,崩溃方法 _hydratePurchaseRecords: 在 BillingCoordinator.swift:218,正是她那次 diff 改动的位置。 第一步:在 BillingCoordinator.swift:218 的 getObjects:andKeys:count: 调用处加 guard 或 unwrap-with-default;在 sandbox 用空 restore response 复现。

P2 — UI 层 rotation 时 layout 残留导致崩溃;仅 iOS 16,占 0.18% 会话。 区域:/ui → 负责人 Mei。最顶层业务帧是 SettingsViewController.viewWillTransition(line 88),Mei 负责 settings 与 transitions。 第一步:在 iPhone 11 + iOS 16.7 上,在 SettingsViewController 旋屏进入 split-view 复现;怀疑 viewWillTransition 里重建的 constraints。

怎么继续打磨

  • AI 编行号 —— 反复强调”只用我给的帧,不许编行号”。
  • 严重级全是 P2 —— 强制按规则。“碰到付费路径至少 P1”。
  • 永远把最新提交者当负责人 —— 要求”先按区域匹配,最近改动只是次要信号”。
  • 输出是大段文字 —— 严格”3 行,固定结构”。
  • AI 提议泛泛修法(“加错误处理”)—— 强制”第一步必须指出 file、method 和要检查什么”。

容易踩的坑

  • 没有代码区域 map 直接 triage——AI 按方法名猜负责人,错率高。
  • 只贴顶帧。崩溃点很少是根因,AI 需要往下 5-8 帧。
  • 忽略设备分布。iOS 版本 60/40 的盘子里 crash 89% 在 iPhone 14/15,说明是结构问题不是 OS 问题。
  • 自动指给最近提交者。最近改动是信号不是规则。

FAQ

Q:AI 推荐的负责人靠谱吗? A:第一周不靠谱。让 AI 基于”最近 30 天该模块的 commit 作者 + code owner”两条规则推荐,再人工纠错;纠错 2-3 周后准确率能到 80%+。让 AI 自由发挥会推荐到已离职的人。

Q:严重级判断会不会被 AI 高估? A:会。AI 看到 NullPointerException 会习惯性标 P1。Prompt 里强制带”影响用户数 / 占总日活百分比 / 是否阻塞主流程”三个维度,少一个就降级。

Q:重复 issue AI 能合并吗? A:堆栈完全相同的能。文案不同但根因相同的(比如同一个空指针在两个入口触发),需要喂给它过去 7 天的 issue 列表才能识别——单条 issue 进单条 issue 出,永远找不到重复。

Q:能直接接 webhook 自动化吗? A:能但别一上来就全自动。先跑两周”AI 出建议 + 人审”,记录 false positive 比例;低于 5% 再考虑把 P3/P4 自动归档、P1/P2 仍走人审。

相关

标签: #AI 写作 #crash-reports #分流 #app-product-ops #独立开发