SRE(AI 驱动的运行与可靠性)
1. 介绍
1.1. 背景:可靠性工作的特殊性
站点可靠性工程(SRE)与软件工程的其他分支有一个根本差异:它的工作对象是正在发生故障的生产系统。这带来三个其他方向不具备的约束:
- 时间压力不对称。写代码可以慢慢想;故障时,每一分钟的平均恢复时间(MTTR)都直接对应业务损失。智能体的价值首先体现在"能不能更快给出可用假设",而不是"能不能给出完美分析"。
- 信息不完整且互相矛盾。故障时刻的指标、日志、链路追踪往往部分缺失、时间不同步、甚至彼此矛盾。这与其他方向"信息大体可信"的前提完全不同。
- 动作不可逆且可能加重故障。写代码改错了可以回滚;生产上执行错误的缓解动作可能把局部故障放大为全局故障。
这三条决定了 SRE 方向的 AI Harness 与编码方向有本质区别:编码方向的 Harness 追求"生成—验证—重试"的闭环,SRE 方向的 Harness 必须追求"假设—验证—止损"的闭环。前者允许试错,后者必须控制爆炸半径。
1.2. 定义
SRE 方向(AI 驱动的运行与可靠性):研究与实践以 AI 智能体参与故障定位、根因分析、容量评估、混沌工程与值守响应,并在保证不加重故障的前提下缩短恢复时间的工程领域。
本方向覆盖五类任务:
| 任务类型 | 说明 | 时间压力 | 可逆性 |
|---|---|---|---|
| 故障定位 | 从告警出发,缩小到具体组件、实例、变更 | 极高 | 只读为主,可逆 |
| 根因分析 | 建立因果链,区分症状与原因 | 高(事中)→ 低(事后) | 只读 |
| 容量评估 | 预测容量需求、识别瓶颈、给出扩容/缩容建议 | 低 | 建议为主 |
| 混沌工程 | 主动注入故障以验证系统韧性 | 低(需受控) | 必须可中止 |
| 值守响应 | 执行缓解动作(限流、回滚、切流、重启) | 极高 | 多为不可逆 |
1.3. 在 AI Harness 体系中的定位
图 1-1|SRE 方向在 AI Harness 六层体系中的定位
数据来源:基于本文分析绘制的示意图。
本方向主层为 L5 评估与观测层,次层为 L4 记忆与状态层与 L6 治理与安全层。
| Harness 层 | 权重 | 本方向的职责 | 具体形态 |
|---|---|---|---|
| L1 上下文工程 | 参与 | 决定模型"看到什么" | 指标/日志/链路的窗口选择与裁剪、拓扑与依赖图、近期变更清单 |
| L2 工具与执行 | 参与 | 决定模型"能做什么" | 只读查询为主;缓解动作必须分级授权 |
| L3 编排与控制 | 参与 | 决定"按什么顺序做" | 诊断流程(假设—验证—收敛)、混沌实验编排与中止 |
| L4 记忆与状态 | 次 | 决定"记住什么" | 事故记忆(Incident Memory):历史故障、已知模式、有效缓解手段 |
| L5 评估与观测 | 主 | 决定"做得好不好" | 可观测性数据、SLO 与错误预算、MTTR 度量、诊断准确率 |
| L6 治理与安全 | 次 | 决定"不能做什么" | 缓解动作白名单、爆炸半径控制、变更留痕、审批与回滚 |
1.4. 瓶颈所在层
本方向的瓶颈在 L5 评估与观测层,具体是两件事:
- 可观测性数据本身的质量。AI 诊断能力与输入数据强相关。如果指标缺失关键维度、日志没有结构化、链路追踪采样率过低,再强的模型也只能给出猜测。行业里"上了 AI 值守却没效果"的案例,绝大多数根因在数据侧而不在模型侧。
- 缺少"假设—验证"的结构化机制。大模型天然倾向于给出一个看似合理的解释(叙事偏好),而根因分析恰恰需要"生成多个候选假设 → 逐一证伪 → 收敛"。没有 Harness 强制这个流程,AI 很容易在第一时间锚定一个错误假设并沿着它一路走偏。
次要瓶颈在 L4 记忆与状态层:事故记忆是 SRE 最稀缺的资产,但它通常以非结构化的复盘文档形式存在,难以被检索复用。把历史故障结构化成"症状 → 候选原因 → 验证方法 → 有效缓解"的四元组,是让 AI 真正发挥价值的前提。
1.5. 价值
- 缩短 MTTR:把"人从告警看到定位"的时间,从数十分钟压缩到分钟级,尤其在跨系统调用链较长的场景。
- 降低值守负担:夜间告警由 AI 做第一轮分诊(triage),过滤噪声、聚合关联告警、给出初步假设与依据。
- 把混沌工程常态化:AI 可以自动生成实验假设、编排注入步骤、判定稳态是否被破坏,从而把"年度演练"变成"周度验证"。
- 把事故知识沉淀下来:每次诊断产生的假设—验证链,都是下一次故障的检索素材。
2. 名词解释
| 术语 | 英文 / 缩写 | 释义 |
|---|---|---|
| 服务等级目标 | Service Level Objective / SLO | 服务可用性或性能的量化目标,是可靠性决策的基准 |
| 服务等级指标 | Service Level Indicator / SLI | 用于衡量 SLO 的具体测量指标 |
| 服务等级协议 | Service Level Agreement / SLA | 对外部的承诺,通常附有违约后果 |
| 错误预算 | Error Budget | 在 SLO 允许的范围内可以消耗的失败额度,用于平衡发布速度与可靠性 |
| 平均恢复时间 | Mean Time To Recovery / MTTR | 从故障发生到服务恢复的平均时长,是本方向的核心指标 |
| 平均检测时间 | Mean Time To Detect / MTTD | 从故障发生到被发现的平均时长 |
| 根因分析 | Root Cause Analysis / RCA | 从症状追溯至根本原因的结构化分析过程 |
| 症状与原因 | Symptom vs. Cause | 症状是可观测的异常表现,原因是导致症状的机制;二者常被混淆 |
| 相关性与因果 | Correlation vs. Causation | 时间上的共现不等于因果;根因分析最常见的错误是把相关当因果 |
| 可观测性三支柱 | Metrics / Logs / Traces | 指标、日志、链路追踪三类遥测数据 |
| 链路追踪 | Distributed Tracing / Trace | 跨服务记录一次请求完整路径的数据,是定位跨系统故障的关键 |
| 拓扑与依赖图 | Topology / Dependency Graph | 描述服务间依赖关系的图,用于影响面分析与故障传播推断 |
| 告警分诊 | Alert Triage | 对告警做去重、聚合、定级与初步归因的过程 |
| 告警疲劳 | Alert Fatigue | 因告警过多或噪声过大导致响应者敏感度下降的现象 |
| 缓解与修复 | Mitigation vs. Remediation | 缓解是快速恢复服务(如回滚、限流),修复是彻底解决问题;事中优先缓解 |
| 爆炸半径 | Blast Radius | 一个动作可能造成的最大影响范围,混沌实验与缓解动作的必评项 |
| 混沌工程 | Chaos Engineering | 通过受控故障注入验证系统韧性的实践 |
| 稳态假设 | Steady-state Hypothesis | 混沌实验中"系统正常时应表现出的可测量行为"的假设 |
| 无指责复盘 | Blameless Postmortem | 聚焦系统与流程而非个人的事故复盘方法 |
| 事故记忆 | Incident Memory | 结构化沉淀的历史故障知识(症状、原因、验证、缓解) |
| 容量余量 | Headroom | 当前用量与容量上限之间的余量 |
| 熔断与限流 | Circuit Breaking / Rate Limiting | 防止故障扩散与过载的保护机制 |
| 值班轮换 | On-call Rotation | 承担值守响应的排班机制 |
3. 案例
说明:以下案例依据公开可核实的一手来源整理。效果数字均标注来源方口径、评测日期与配置;自评口径与实测口径分别标注。
3.1. 案例一:终端环境下的故障诊断能力边界
来源:Terminal-Bench 2.0 官方榜单,https://www.tbench.ai/
3.1.1. 背景
SRE 的日常工作高度依赖终端:查看进程、检查配置、分析日志、验证网络连通性、修改系统参数。与编程任务不同,这类任务的每一步都可能改变系统状态,且多数不可逆。因此,衡量智能体在终端环境下的表现,对评估 SRE 方向的可行性具有直接参考价值。
3.1.2. 方案(评测设计视角)
Terminal-Bench 2.0 的任务设计要求智能体在真实终端环境中完成数十至数百步操作,最终由一组断言脚本判定成功与否。这一设计与 SRE 的实际工作有三点对应:
- 状态依赖:每一步的结果依赖前一步的系统状态,无法用纯文本推理替代。
- 不可逆操作:错误的删除或覆盖无法通过"重新生成"挽回,必须靠规划避免。
- 可判定:成功与否由断言确定,避免主观评分——这与 SRE 中"服务是否恢复"的判定方式一致。
3.1.3. 效果
| 模型 | 得分 | 评测日期 | 备注 |
|---|---|---|---|
| Claude Sonnet 4.5 | 51.0% | 2025-09-29 | 该榜首个突破 50% 的成绩 |
| GPT-5.2 | 54.0% | 2025-12-11 | 后续刷新 |
解读(对 SRE 落地的直接含义):
- 约半数长时程终端任务仍会失败。这意味着在 SRE 场景中,AI 应被定位为辅助诊断而非自主处置:它可以把候选原因从 20 个缩到 3 个,但最终动作仍应由人决定。
- 失败模式而非成功率更值得关注。在可靠性场景中,AI 的失败往往不是"没找到原因",而是"找到了一个错误但听起来合理的原因"——后者更危险,因为它会让响应者沿着错误方向浪费宝贵的恢复时间。
- Terminal-Bench 2.0 的完整榜单与细分项得分标注为 。
3.2. 案例二:图形界面环境下的操作型排障
来源:OSWorld-Hard 榜单(OSWorld 项目)
3.2.1. 背景
大量运维工作并非发生在命令行,而是在图形界面中:云厂商控制台、监控看板、工单系统、内部管理平台。这些系统往往没有完善的 API,操作只能通过与图形界面交互完成。因此,智能体在 GUI 环境下的操作能力,直接决定了它能覆盖多大比例的 SRE 场景。
3.2.2. 方案(评测设计视角)
OSWorld-Hard 要求智能体在真实操作系统环境中,通过屏幕观察与鼠标键盘操作完成任务。与终端任务相比,它增加了两层难度:
- 感知难度:状态只能通过屏幕像素推断,没有结构化输出。
- 操作精度:点击位置错误可能导致不可逆后果(例如点错"删除"而非"重启")。
3.2.3. 效果
| 模型 | 得分 | 评测日期 | 备注 |
|---|---|---|---|
| GPT-5.2-Codex | 61.4% | [待填写:评测日期] | — |
| Claude Opus 4.5 | 58.0% | [待填写:评测日期] | — |
解读:
- GUI 环境下的成绩同样处于 60% 上下,与终端任务(51.0%—54.0%)处于同一量级。这提示:当前 AI 在"需要在真实环境中连续操作"的任务上,能力上限大致在六成左右。
- 对 SRE 而言,这个量级足以支撑"分诊与假设生成",不足以支撑"无人值守的自动处置"。
- GUI 操作的不可逆性更高,因此本方向的落地原则是:只读分析可自动化,写操作必须分级授权。
3.3. 案例三:AI 时代的可靠性行业基线
来源:DORA 2025 State of AI-assisted Software Development,2025-11-12;Google DORA《AI-assisted software development》,2025-10-08;Stack Overflow 2025 开发者调查,2025-07-30
3.3.1. 背景
AI 编码工具提高了变更产生的速度。但可靠性工程有一条朴素规律:变更是故障的首要来源。如果变更速度上升而变更质量与验证能力没有同步提升,变更失败率必然上升。因此,SRE 方向必须回答一个问题:AI 时代,可靠性是变好了还是变坏了?
3.3.2. 方案
采用 DORA 四指标框架作为统一度量口径——部署频率、变更前置时间、变更失败率、服务恢复时间。该框架的价值在于:它同时测量速度与稳定性,使"更快"与"更稳"之间的权衡变得可见,避免只测速度而忽略稳定性。
3.3.3. 效果
表 3-1 AI 采用现状与可靠性相关的关键发现
| 指标 | 数值 | 时间 | 口径 |
|---|---|---|---|
| 开发者使用 AI 比例 | 90%+ | 2025-11-12 | DORA 2025,自评 |
| 自评生产力提升 | +80% | 2025-11-12 | DORA 2025,自评 |
| 代码评审时间变化 | -90% | 2025-11-12 | DORA 2025,自评 |
| 单次任务耗时 > 4 小时的比例 | 30% | 2025-11-12 | DORA 2025 |
| 使用或计划使用 AI 的比例 | 84% | 2025-07-30 | Stack Overflow 2025 |
| 不信任 AI 输出准确性 | 46% | 2025-07-30 | Stack Overflow 2025 |
| 资深开发者实测效率变化 | -19%(变慢) | 2025-07-10 | METR 随机对照试验,实测 |
解读(本方向最需要警惕的组合):
- 评审时间 -90% + 46% 不信任准确性,是一个矛盾组合:一边是评审投入大幅下降,一边是近半数从业者不信任产出。这提示评审可能变浅了,而变浅的评审正是缺陷逃逸的入口。
- 30% 的任务单次超 4 小时:说明大量任务并未因 AI 而变简单。长任务在故障场景下尤其危险——恢复时间被拉长。
- 自评 +80% 对实测 -19%:这是本方向最重要的认知警示。在可靠性领域,错误的主观判断会直接导致错误的容量决策与错误的自动化授权。
- 结论:AI 时代 SRE 的第一任务不是"用 AI 提速",而是建立客观度量——先能测准,再谈改善。
4. 实践标准
4.1. AGENTS.md 规范
以下为本方向的完整 AGENTS.md 原文,置于代码块中以便直接复制。使用时须叠加组级 AGENTS.md 的共同条款,冲突时以就近优先原则消解。
# AGENTS.md —— 软件工程 · SRE 方向(运行与可靠性)
## 角色与边界
- 本文件约束**参与生产系统可靠性工作的 AI 智能体**:故障定位、根因分析、容量评估、混沌工程、值守响应。
- 允许自行完成:只读查询(指标、日志、链路、配置、拓扑)、生成候选假设与验证方法、生成故障时间线、生成复盘草稿、生成容量建议、生成混沌实验方案、按白名单执行**已授权的低风险只读诊断命令**。
- 禁止自行完成:执行任何改变生产状态的动作(重启、扩缩容、切流、限流、回滚、数据修复)、修改告警规则或阈值、删除或归档日志与监控数据、在故障期间执行实验性命令。
- 边界判定:**只读与写入的分界线就是本方向的权限红线**。缓解动作(Mitigation)必须由人执行,除非该动作已被显式列入白名单并获得事前授权。
- 核心原则:**事中优先缓解(Mitigation),而非根因修复(Remediation)**。AI 的目标是缩短恢复时间,不是查明真相。
## 环境假设
- 提供可观测性数据访问:指标(Metrics)、日志(Logs)、链路追踪(Traces),且时间同步、有统一的服务标识。
- 提供拓扑与依赖图;提供近期变更清单(部署、配置、基础设施变更)。
- 提供事故库(Incident DB)的只读访问,含历史故障的结构化记录。
- 提供只读的云/集群 API 访问;写操作默认关闭。
- 提供权威时间源;**所有时间线必须统一时区与时钟源**。
- 提供操作审计日志,且智能体不可删改。
- 缺失任一项时降级执行并显式声明;**时间不同步时必须声明"时间线不可信"**。
## 上下文加载顺序(Context Budget)
1. 任务契约:目标系统、影响面、时间窗、验收标准(固定,不压缩)
2. 就近指令文件:当前服务/目录的运维约定
3. 告警与症状:告警列表、用户报告、SLO 状态
4. 时间窗内的遥测:指标异常段、相关日志摘要、关键链路样本(**裁剪后的**)
5. 拓扑与依赖:受影响服务及其上下游
6. 近期变更:时间窗内的部署/配置/基础设施变更
7. 事故记忆:相似历史故障的四元组(症状/原因/验证/缓解)
8. 工具结果:按需追加
记录 Token 预算表。遥测数据必须裁剪(聚合、采样、异常段提取),**禁止把原始日志全量灌入上下文**。
## 工具契约
- 副作用分级:R(只读查询)/ W(工作区写,如生成报告)/ X(沙箱内执行)/ S(改变生产状态,需确认)/ D(不可逆,默认拒绝)。
- **诊断命令白名单**:只读诊断命令(如查看状态、读取配置、查询指标)可列入白名单自动执行;其余一律需确认。
- **缓解动作白名单**:仅事前经审批的动作(如特定服务的扩容、特定开关的切换)可列入白名单;每次执行必须留痕。
- 一切实验性、探索性命令禁止在生产环境执行。
- 所有执行类工具必须设置超时;超时即失败。
- 输出超限时必须聚合或采样,禁止全量灌入。
## 任务执行流程(SOP)
1. 确认契约:目标系统、影响面、时间窗、是否处于故障中。
2. 采集症状:告警、SLO 状态、用户报告;建立**统一时基**。
3. 建立时间线:按时间排序 症状 / 变更 / 告警 / 缓解动作。
4. 缩小范围:用拓扑与依赖图把范围从"整个系统"缩小到"具体组件"。
5. **生成候选假设(≥3 个)**:每个假设必须写明"若成立,应观察到什么"。
6. **逐一验证**:对每个假设给出可执行的验证方法与预期结果;**验证必须落在数据上,不能落在推理上**。
7. 收敛:保留未被证伪的假设,给出置信度与依据;**禁止只给一个假设**。
8. 给出建议:区分 缓解建议(立即)与 修复建议(事后)。
9. 留痕:归档时间线、假设—验证链、结论与置信度。
## 验证与证据要求
| 验证项 | 判定 | 证据 |
|---|---|---|
| 时间线时基统一 | 全部事件同一时钟源 | 时间线(含时区标注) |
| 假设数量 ≥ 3 | 非单一叙事 | 假设清单 |
| 每个假设有可验证预期 | "若成立应观察到 X" | 假设表 |
| 验证落在数据上 | 有具体的查询/命令与结果 | 验证记录(命令 + 输出摘要) |
| 区分相关与因果 | 已显式说明为何不是仅相关 | 因果论证段落 |
| 区分症状与原因 | 已标注哪些是症状 | 标注 |
| 缓解建议可执行 | 有具体动作与影响面 | 缓解方案 |
| 爆炸半径已评估 | 每个建议动作的影响范围已知 | 影响面评估 |
**禁止**:
- 以"最可能的原因是……"作为唯一结论而不给候选集。
- 以时间上的先后共现作为因果依据("变更后故障,所以变更导致故障"必须进一步验证)。
- 以无数据的推理替代查询。
**必须**:无法确定根因时,明确输出"根因未确定"并列出已排除的假设——这是有效结论,不得为了给出答案而猜测。
## 失败与升级策略
- 数据缺失(日志缺失、采样不足):声明"数据不足以判定",升级人工,禁止猜测。
- 假设全部被证伪:回到采集阶段,扩大时间窗或范围;禁止降低标准强行收敛。
- 缓解动作未授权:不得执行;输出建议与依据,等待授权。
- 操作可能加重故障:立即停止,升级。
- 时间不同步:声明时间线不可信,先对齐时钟。
升级三要素:已尝试动作与结果 / 卡点现象与证据 / 建议选项及风险。缺一无效。
## 安全与合规红线
1. 禁止执行任何未列入白名单的生产写操作。
2. 禁止在故障期间执行实验性或探索性命令。
3. 禁止修改告警规则、阈值、静默策略以"降低噪声"。
4. 禁止删除、归档、覆盖日志、指标、链路与审计数据。
5. 禁止访问与当前故障无关的生产数据(尤其含个人信息的数据)。
6. 缓解动作必须先评估爆炸半径;影响面超出授权范围即升级。
7. AI 系统的功能安全论证参考 ISO/IEC TR 5469:2024;可信赖性论证参考 ISO/IEC TR 24028:2020。
8. 风险管理对齐 NIST CSF 2.0(2024-02-26)的检测(DE)与响应(RS)功能。
9. 故障时间线与处置记录属于成文信息,按 ISO/IEC 42001:2023 的要求留存。
## 禁止事项
1. 禁止给出单一假设而不给候选集。
2. 禁止把相关性表述为因果性。
3. 禁止在无数据时给出结论。
4. 禁止在故障期间擅自执行缓解动作(未列入白名单者)。
5. 禁止使用 `[待填写]`、`XX`、`___` 之外的非标准占位符;不确定处统一使用 `[待填写]`。
6. 禁止以"模型认为"作为技术判断依据。
7. 禁止删除或改写他人的运维手册、告警配置与审计日志。
## 输出格式
故障场景输出必须包含:
- **状态摘要**:当前影响面、SLO 状态、是否已缓解
- **时间线**:时间 / 事件 / 来源 / 置信度
- **候选假设表**:假设 / 若成立应观察到 / 验证方法 / 验证结果 / 结论
- **结论**:未被证伪的假设(含置信度);或"根因未确定"+ 已排除清单
- **建议**:缓解建议(立即)/ 修复建议(事后)/ 预防建议
- **证据附录**:执行的查询与命令、输出摘要
## 评估与自检
| 自检项 | 判定 |
|---|---|
| 时间线时基统一 | 是 / 否 |
| 候选假设 ≥ 3 个 | 是 / 否 |
| 每个假设有可验证预期 | 是 / 否 |
| 验证落在数据上(有查询与结果) | 是 / 否 |
| 已区分症状与原因 | 是 / 否 |
| 已区分相关与因果 | 是 / 否 |
| 缓解建议含爆炸半径评估 | 是 / 否 |
| 未确定时已明确声明(未强行给答案) | 是 / 否 |
任一"否"须显式列出;自检不通过即任务未完成。
度量口径:MTTD、MTTR、诊断准确率(事后复盘验证)、告警噪声比、缓解动作成功率。禁止以"响应感觉更快了"作为结论。 4.2. SKILL.md 规范
---
name: incident-diagnosis-with-hypothesis-gate
description: 对一次生产故障做结构化诊断——统一时基建立时间线、用拓扑缩小范围、生成不少于三个候选假设并逐一用数据验证、区分症状与原因、区分相关与因果、输出带置信度的结论与分级建议。适用于故障定位、根因分析、值守分诊。当需要 AI 参与故障诊断但必须避免"单一叙事"误判时使用。
version: 1.0
created: 2026-09-12
---
# 带假设门禁的故障诊断
## 适用场景
- 生产告警触发,需要快速定位影响范围与候选原因。
- 故障已恢复,需要做根因分析与复盘。
- 值守分诊:判断告警是否值得唤醒人工、属于哪个服务、可能的原因类别。
- 容量异常(如水位突增)需要归因。
不适用于:无遥测数据的场景(数据不足时本技能应直接声明不可用)、计划内的变更验证、安全事件调查(走安全流程)。
## 前置条件
| 类别 | 要求 | 缺失时处置 |
|---|---|---|
| 时基 | 所有数据源时钟同步 | 声明"时间线不可信",先对齐 |
| 遥测 | 指标、日志、链路至少其一可用 | 数据不足即声明不可用 |
| 拓扑 | 服务依赖关系可见 | 降级为逐服务排查 |
| 变更记录 | 时间窗内的变更可查 | 声明"变更关联无法验证" |
| 权限 | 只读访问;写操作需白名单 | 按最低权限执行 |
## 输入
- 告警内容或故障描述
- 目标服务与影响面
- 时间窗(起止时间,含时区)
- 可用的遥测数据源清单
## 输出
- 状态摘要(影响面、SLO 状态、是否已缓解)
- 时间线(时间 / 事件 / 来源 / 置信度)
- 候选假设表(假设 / 预期观察 / 验证方法 / 结果 / 结论)
- 结论(含置信度)或"根因未确定 + 已排除清单"
- 三级建议:缓解 / 修复 / 预防
## 执行步骤
1. **确认契约**:目标服务、影响面、时间窗、是否故障中。
2. **统一时基**:确认所有数据源的时钟源与时区;不一致则先标注。
3. **采集症状**:告警、SLO/错误预算状态、用户报告;明确"什么是异常"。
4. **建立时间线**:按序记录 症状 / 变更 / 告警 / 缓解动作,每条标注来源与置信度。
5. **缩小范围**:用拓扑与依赖图从"系统"缩小到"组件";优先排除法(哪些部分确定正常)。
6. **生成候选假设(≥3)**:每条写明"若该假设成立,应观察到 X"。**禁止只给一个假设**。
7. **逐一验证**:对每条假设执行具体查询或命令,记录输出摘要;验证必须落在数据上。
8. **收敛与置信度**:保留未被证伪的假设,给出置信度与依据;全部证伪则回到第 4 步扩大范围。
9. **区分因果**:对"时间上共现"的证据显式论证为何是因果而非相关(如:有剂量—反应关系、有机制解释、可复现)。
10. **输出建议**:缓解(立即、含爆炸半径)/ 修复(事后)/ 预防(长期)。
11. **留痕**:归档时间线、假设—验证链、结论、证据。
## 质量标准(DoD)
1. 时间线时基统一,含时区标注。
2. 候选假设不少于 3 个,且彼此互斥或可区分。
3. 每条假设都有"若成立应观察到"的可验证预期。
4. 验证落在数据上:有具体查询/命令与输出摘要。
5. 明确区分症状与原因。
6. 明确区分相关与因果,并对因果给出机制解释或复现证据。
7. 结论带置信度;无法确定时明确输出"根因未确定"+ 已排除清单。
8. 缓解建议含爆炸半径评估与回滚方式。
9. 未执行任何未授权的写操作。
10. 全过程留痕,可事后复盘。
## 常见失败与处理
| 失败 | 表现 | 处理 |
|---|---|---|
| 单一叙事 | 只给一个"最可能原因" | 强制候选集 ≥ 3;否则判定不合格 |
| 相关当因果 | "变更后故障,所以是变更导致" | 要求机制解释或复现证据;否则降级为"待验证" |
| 数据不足 | 日志缺失、采样过低 | 声明"数据不足以判定",不得猜测 |
| 时间不同步 | 各源时间对不上 | 标注"时间线不可信",先对齐 |
| 假设全证伪 | 无假设成立 | 扩大时间窗或范围,禁止强行收敛 |
| 擅自处置 | 执行了未授权缓解 | 判定为红线违反,回滚并复盘 |
| 噪声淹没 | 告警过多无法定位 | 先做分诊聚合,再定位 |
## 示例
**场景**:支付服务 P99 延迟从 200ms 升至 3s,错误率从 0.1% 升至 4%。
- 时基:全部数据源统一为 UTC+8,已校验 NTP 同步。
- 时间线:14:02 部署 v2.3.1;14:05 延迟开始上升;14:07 错误率上升;14:12 告警触发。
- 范围:支付服务 → 依赖的账务服务(正常)→ 数据库连接池(活跃连接数打满)。
- 候选假设:
1. 新版本引入慢查询,连接占用时间变长 → 预期:慢查询日志中新 SQL 出现(**验证:存在,成立**)
2. 流量突增导致连接池不足 → 预期:QPS 显著上升(**验证:QPS 平稳,证伪**)
3. 数据库侧故障 → 预期:DB 指标异常或其他服务也受影响(**验证:DB 正常且其他服务无异常,证伪**)
- 因果论证:新 SQL 的耗时与连接池占用时长呈剂量—反应关系,且回滚后指标恢复 → 因果成立,非仅相关。
- 建议:缓解(回滚 v2.3.1,爆炸半径=单服务)/ 修复(优化该 SQL 并加索引)/ 预防(上线前慢查询门禁 + 连接池水位告警)。
- 置信度:高(已被回滚验证)。 4.3. 落地检查清单
可观测性基础(L5,前提中的前提)
- [ ] 指标、日志、链路三类数据齐备,且统一服务标识
- [ ] 所有数据源时钟同步,时间线可信
- [ ] 链路追踪采样策略已明确,关键路径采样率足够
- [ ] 日志结构化(非纯文本),可按字段检索
- [ ] 拓扑与依赖图维护中,且与实际一致
- [ ] 时间窗内的变更记录可查(部署、配置、基础设施)
诊断流程(L3 + L5)
- [ ] 诊断 SOP 强制"候选假设 ≥ 3",禁止单一叙事
- [ ] 每个假设必须有"若成立应观察到"的可验证预期
- [ ] 验证结果必须落在数据上(有查询与输出),不得只靠推理
- [ ] 明确区分症状与原因
- [ ] 明确区分相关与因果,因果需机制解释或复现证据
- [ ] "根因未确定"是允许的输出,且必须附已排除清单
事故记忆(L4)
- [ ] 历史故障被结构化为四元组:症状 / 原因 / 验证方法 / 有效缓解
- [ ] 事故库可被诊断智能体检索
- [ ] 每次诊断的假设—验证链被归档为下一次的素材
- [ ] 复盘采用无指责方法,聚焦系统与流程
动作控制(L6)
- [ ] 只读诊断命令有白名单,可自动执行
- [ ] 缓解动作有白名单,且每次执行留痕
- [ ] 每个缓解动作有爆炸半径评估
- [ ] 故障期间禁止实验性命令(硬性)
- [ ] AI 不得修改告警规则、阈值与静默策略
- [ ] 日志、指标、链路、审计数据 AI 不可删除
混沌工程
- [ ] 实验有明确的稳态假设(可测量的正常行为)
- [ ] 实验有爆炸半径声明与中止开关
- [ ] 实验在受控环境或受控时间窗进行
- [ ] 实验结果回写为韧性改进项
度量
- [ ] MTTD、MTTR 在测且可归因
- [ ] 诊断准确率通过事后复盘验证(非自评)
- [ ] 告警噪声比在测,且有降噪机制
- [ ] 缓解动作成功率在测
- [ ] 自评数据与实测数据分别标注,未混用
5. 总结
SRE 方向是 AI Harness 中最不能容忍 AI 自信犯错的方向。在编码场景,AI 的错误产出一个补丁,人可以不采纳;在故障场景,AI 的错误判断会让响应者沿着错误方向消耗掉最宝贵的恢复时间。
本方向的核心结论:
- 瓶颈在 L5 评估与观测层,而且首先是可观测性数据本身的质量。没有结构化、时基统一、覆盖充分的遥测数据,再强的模型也只能猜测。行业里"AI 值守没效果"的案例,绝大多数根因在数据侧。
- 必须用 Harness 强制"假设—验证"结构,对抗模型的叙事偏好。大模型倾向于给出一个看似合理的解释,而根因分析需要"多个候选 → 逐一证伪 → 收敛"。候选假设 ≥ 3、每条带可验证预期、验证落在数据上——这三条是最低要求。
- 能力上限决定了定位。Terminal-Bench 2.0 上 51.0%—54.0%、OSWorld-Hard 上 58.0%—61.4%,说明当前 AI 在需要真实环境连续操作的任务上成功率约在六成。这足以支撑"分诊与假设生成",不足以支撑"无人值守的自动处置"。因此本方向的落地原则是:只读分析可自动化,写操作必须分级授权。
最后,本方向必须牢记那组背离的数字:DORA 2025 显示自评生产力 +80%、评审时间 -90%,而 METR 随机对照试验(2025-07-10)显示资深开发者实测慢 19%,Stack Overflow 2025 显示 46% 的从业者不信任 AI 输出准确性。在可靠性领域,主观判断的偏差会直接转化为容量误判与过度授权。先能测准,再谈改善——这是 AI 时代 SRE 的第一原则。
信息缺口声明
- OSWorld-Hard 上 GPT-5.2-Codex(61.4%)与 Claude Opus 4.5(58.0%)的具体评测日期标注为
[待填写]。 - Terminal-Bench 2.0 的完整榜单与细分项得分标注为 。
- 各组织自身的 MTTD / MTTR / 诊断准确率基线标注为
[待填写],需以内部度量填补。 - 混沌工程在 AI 参与下的具体实践数据缺乏公开可核实来源,本文仅给出方法学要求,未引用量化效果。
- 本方向的部分企业案例细节与来源 URL 待检索报告补充后回填。
6. 参考资料
- Terminal-Bench 官方榜单 — Laude Institute 等。https://www.tbench.ai/
- OSWorld 官方站点(OSWorld-Hard) — OSWorld 项目。https://os-world.github.io/
- DORA 2025 State of AI-assisted Software Development — Google Cloud / DORA,2025-11-12。https://dora.dev/research/2025/dora-report/
- AI-assisted software development — Google DORA,2025-10-08。https://dora.dev/
- Measuring the Impact of Early-2025 AI on Experienced Open-Source Developer Productivity — METR,2025-07-10。https://metr.org/blog/2025-07-10-early-2025-ai-experienced-os-dev-study/
- Stack Overflow 2025 Developer Survey — Stack Overflow,2025-07-30。https://survey.stackoverflow.co/2025/
- Site Reliability Engineering(SRE 原著) — Google。https://sre.google/books/
- OpenTelemetry 语义约定 — OpenTelemetry。https://opentelemetry.io/docs/concepts/semantic-conventions/
- ISO/IEC TR 5469:2024 人工智能 — 功能安全与 AI 系统 — ISO/IEC,2024。
- ISO/IEC TR 24028:2020 人工智能 — 可信赖性概述 — ISO/IEC,2020。
- NIST Cybersecurity Framework (CSF) 2.0 — NIST,2024-02-26。https://www.nist.gov/cyberframework
- NIST AI Risk Management Framework (AI RMF 1.0) 及 GenAI Profile — NIST,2024-07-26。https://www.nist.gov/itl/ai-risk-management-framework
SRE (AI-Driven Operations and Reliability)
1. Introduction
1.1. Background: The Special Nature of Reliability Work
Site Reliability Engineering (SRE) has a fundamental difference from other branches of software engineering: its object of work is production systems that are actively failing. This introduces three constraints that the other directions do not have:
- Asymmetric time pressure. Writing code can take all the time needed; during an outage, every minute of mean time to recovery (MTTR) directly corresponds to business loss. The value of an agent is first reflected in "can it produce a usable hypothesis faster," not "can it produce a perfect analysis."
- Incomplete and contradictory information. At the moment of an outage, metrics, logs, and traces are often partially missing, time-unsynchronized, or even mutually contradictory. This is completely different from the "information is largely trustworthy" premise of other directions.
- Irreversible actions that may worsen the outage. A coding mistake can be rolled back; executing a wrong mitigation action in production can amplify a localized failure into a global one.
These three points determine that the AI Harness for the SRE direction differs fundamentally from that for the coding direction: the Harness for coding pursues a "generate–verify–retry" loop, while the Harness for SRE must pursue a "hypothesis–verify–contain-loss" loop. The former allows trial and error; the latter must control the blast radius.
1.2. Definition
SRE direction (AI-driven operations and reliability): an engineering field that researches and practices using AI agents to participate in fault localization, root-cause analysis, capacity assessment, chaos engineering, and on-call response, and to shorten recovery time while guaranteeing that the outage is not worsened.
This direction covers five types of tasks:
| Task Type | Description | Time Pressure | Reversibility |
|---|---|---|---|
| Fault localization | Starting from alerts, narrowing down to specific components, instances, and changes | Extremely high | Mostly read-only, reversible |
| Root-cause analysis | Establishing a causal chain, distinguishing symptoms from causes | High (during) → Low (after) | Read-only |
| Capacity assessment | Predicting capacity needs, identifying bottlenecks, and giving scale-up/scale-down recommendations | Low | Mostly advisory |
| Chaos engineering | Proactively injecting failures to verify system resilience | Low (must be controlled) | Must be abortable |
| On-call response | Executing mitigation actions (rate limiting, rollback, traffic shifting, restart) | Extremely high | Mostly irreversible |
1.3. Positioning Within the AI Harness System
图 1-1|SRE 方向在 AI Harness 六层体系中的定位
数据来源:基于本文分析绘制的示意图。
The primary layer of this direction is the L5 Evaluation and Observability layer, with the L4 Memory and State layer and the L6 Governance and Security layer as secondary layers.
| Harness Layer | Weight | Responsibility in This Direction | Concrete Form |
|---|---|---|---|
| L1 Context Engineering | Participates | Determines "what the model sees" | Window selection and trimming of metrics/logs/traces, topology and dependency graphs, recent change lists |
| L2 Tools and Execution | Participates | Determines "what the model can do" | Mainly read-only queries; mitigation actions must be authorized by tier |
| L3 Orchestration and Control | Participates | Determines "in what order to do things" | Diagnostic flow (hypothesis–verify–converge), chaos experiment orchestration and abort |
| L4 Memory and State | Secondary | Determines "what to remember" | Incident Memory: historical failures, known patterns, effective mitigations |
| L5 Evaluation and Observability | Primary | Determines "how well it is done" | Observability data, SLOs and error budgets, MTTR metrics, diagnostic accuracy |
| L6 Governance and Security | Secondary | Determines "what must not be done" | Mitigation action whitelist, blast-radius control, change logging, approval and rollback |
1.4. Bottleneck Layer
The bottleneck of this direction lies in the L5 Evaluation and Observability layer, specifically two things:
- The quality of the observability data itself. AI diagnostic capability is strongly correlated with the input data. If metrics are missing key dimensions, logs are not structured, or trace sampling rates are too low, even the strongest model can only guess. In the industry, in most cases of "AI on-call deployed but ineffective," the root cause lies on the data side, not the model side.
- The lack of a structured "hypothesis–verify" mechanism. Large models naturally tend to give one plausible-sounding explanation (narrative bias), whereas root-cause analysis precisely needs to "generate multiple candidate hypotheses → falsify each in turn → converge." Without a Harness enforcing this process, the AI can easily anchor onto a wrong hypothesis at the outset and follow it all the way astray.
A secondary bottleneck lies in the L4 Memory and State layer: incident memory is the scarcest asset in SRE, but it usually exists as unstructured postmortem documents that are hard to retrieve and reuse. Structuring historical failures into a four-tuple of "symptom → candidate cause → verification method → effective mitigation" is the precondition for AI to genuinely deliver value.
1.5. Value
- Shorten MTTR: compress the time from "human sees the alert to localization" from tens of minutes down to minutes, especially in scenarios with long cross-system call chains.
- Reduce on-call burden: night alerts are handled by the AI in the first round of triage, filtering noise, aggregating related alerts, and giving initial hypotheses with supporting evidence.
- Make chaos engineering routine: the AI can automatically generate experiment hypotheses, orchestrate injection steps, and determine whether the steady state has been broken, thereby turning "annual drills" into "weekly verification."
- Accumulate incident knowledge: every hypothesis–verify chain produced by each diagnosis becomes retrieval material for the next failure.
2. Glossary
| Term | English / Abbreviation | Definition |
|---|---|---|
| Service level objective | Service Level Objective / SLO | A quantified target for service availability or performance, and the baseline for reliability decisions |
| Service level indicator | Service Level Indicator / SLI | A concrete measurement metric used to gauge an SLO |
| Service level agreement | Service Level Agreement / SLA | A commitment made externally, usually with consequences for non-compliance |
| Error budget | Error Budget | The amount of failure that may be consumed within the tolerance allowed by an SLO, used to balance release speed and reliability |
| Mean time to recovery | Mean Time To Recovery / MTTR | The average time from failure onset to service recovery; this is the core metric of this direction |
| Mean time to detect | Mean Time To Detect / MTTD | The average time from failure onset to detection |
| Root cause analysis | Root Cause Analysis / RCA | A structured analysis process that traces from symptoms back to the root cause |
| Symptom vs. cause | Symptom vs. Cause | A symptom is an observable abnormal manifestation, while a cause is the mechanism producing the symptom; the two are often confused |
| Correlation vs. causation | Correlation vs. Causation | Co-occurrence in time does not equal causation; the most common mistake in root-cause analysis is treating correlation as causation |
| Three pillars of observability | Metrics / Logs / Traces | The three kinds of telemetry data: metrics, logs, and traces |
| Distributed tracing | Distributed Tracing / Trace | Data that records the complete path of a request across services; key to localizing cross-system failures |
| Topology / dependency graph | Topology / Dependency Graph | A graph describing dependency relationships between services, used for impact analysis and fault-propagation inference |
| Alert triage | Alert Triage | The process of de-duplicating, aggregating, prioritizing, and initially attributing alerts |
| Alert fatigue | Alert Fatigue | The phenomenon in which over-many or overly noisy alerts reduce responders' sensitivity |
| Mitigation vs. remediation | Mitigation vs. Remediation | Mitigation is quickly restoring service (e.g., rollback, rate limiting); remediation is thoroughly fixing the problem; prioritize mitigation during an incident |
| Blast radius | Blast Radius | The maximum scope of impact an action could cause; a mandatory evaluation item for chaos experiments and mitigation actions |
| Chaos engineering | Chaos Engineering | The practice of verifying system resilience through controlled fault injection |
| Steady-state hypothesis | Steady-state Hypothesis | A hypothesis about the "measurable behavior a system should exhibit when healthy" in a chaos experiment |
| Blameless postmortem | Blameless Postmortem | An incident review method that focuses on systems and processes rather than individuals |
| Incident memory | Incident Memory | Structured historical failure knowledge (symptoms, causes, verification, mitigations) |
| Headroom | Headroom | The margin between current usage and the capacity upper limit |
| Circuit breaking / rate limiting | Circuit Breaking / Rate Limiting | Protection mechanisms that prevent failure propagation and overload |
| On-call rotation | On-call Rotation | The scheduling mechanism that assigns on-call response duties |
3. Case Studies
Note: The following cases are compiled from verifiable public primary sources. Every effectiveness figure is annotated with the source's methodology, evaluation date, and configuration; self-reported and externally measured figures are labeled separately.
3.1. Case One: The Boundary of Fault-Diagnosis Capability in Terminal Environments
Source: Terminal-Bench 2.0 official leaderboard, https://www.tbench.ai/
3.1.1. Background
SRE daily work is highly dependent on the terminal: inspecting processes, checking configurations, analyzing logs, verifying network connectivity, and modifying system parameters. Unlike programming tasks, every step in such tasks may alter system state, and most steps are irreversible. Therefore, measuring an agent's performance in terminal environments has direct reference value for evaluating the feasibility of the SRE direction.
3.1.2. Approach (from the Evaluation-Design Perspective)
Terminal-Bench 2.0 tasks require the agent to complete dozens to hundreds of operations in a real terminal environment, with success ultimately determined by a set of assertion scripts. This design corresponds to real SRE work in three ways:
- State dependency: the result of each step depends on the system state left by the previous step, and cannot be replaced by pure text-based reasoning.
- Irreversible operations: an erroneous deletion or overwrite cannot be undone by "regenerating," so it must be avoided through planning.
- Determinism: success or failure is determined by assertions, avoiding subjective scoring — this matches the SRE judgment of "whether the service has recovered."
3.1.3. Results
| Model | Score | Evaluation Date | Note |
|---|---|---|---|
| Claude Sonnet 4.5 | 51.0% | 2025-09-29 | The first score on this leaderboard to break 50% |
| GPT-5.2 | 54.0% | 2025-12-11 | Later improvement |
Interpretation (direct implications for SRE adoption):
- Roughly half of long-horizon terminal tasks still fail. This means that in SRE scenarios, the AI should be positioned as diagnostic assistance rather than autonomous response: it can narrow candidate causes from 20 to 3, but the final action should still be decided by a human.
- Failure modes matter more than success rate. In reliability scenarios, AI failure is often not "it didn't find a cause" but "it found a wrong but plausible-sounding cause" — the latter is more dangerous, because it causes responders to waste precious recovery time in the wrong direction.
- The full Terminal-Bench 2.0 leaderboard and per-category scores are labeled
[To be verified].
3.2. Case Two: Operational Troubleshooting in GUI Environments
Source: OSWorld-Hard leaderboard (OSWorld project)
3.2.1. Background
A great deal of operations work does not happen on the command line but in GUI environments: cloud provider consoles, monitoring dashboards, ticketing systems, and internal management platforms. These systems often lack a complete API, so operations can only be performed by interacting with the graphical interface. Therefore, the agent's operational ability in GUI environments directly determines what proportion of SRE scenarios it can cover.
3.2.2. Approach (from the Evaluation-Design Perspective)
OSWorld-Hard requires the agent to complete tasks in a real operating system environment, through screen observation and mouse-and-keyboard operations. Compared with terminal tasks, it adds two layers of difficulty:
- Perception difficulty: state can only be inferred from screen pixels, with no structured output.
- Operational precision: a wrong click position can lead to irreversible consequences (for example, clicking "Delete" instead of "Restart").
3.2.3. Results
| Model | Score | Evaluation Date | Note |
|---|---|---|---|
| GPT-5.2-Codex | 61.4% | [To be filled: evaluation date] | — |
| Claude Opus 4.5 | 58.0% | [To be filled: evaluation date] | — |
Interpretation:
- Scores in GUI environments are also around 60%, in the same order of magnitude as terminal tasks (51.0%–54.0%). This suggests that for tasks requiring continuous operation in real environments, the current ceiling of AI capability is roughly 60%.
- For SRE, this order of magnitude is sufficient to support "triage and hypothesis generation," but not sufficient to support "unattended automatic response."
- GUI operations are more irreversible, so the adoption principle for this direction is: read-only analysis can be automated, but write operations must be authorized by tier.
3.3. Case Three: The Reliability Industry Baseline in the AI Era
Source: DORA 2025 State of AI-assisted Software Development, 2025-11-12; Google DORA AI-assisted software development, 2025-10-08; Stack Overflow 2025 Developer Survey, 2025-07-30
3.3.1. Background
AI coding tools have increased the speed at which changes are produced. But reliability engineering has a simple rule: changes are the primary source of failures. If the change speed rises while change quality and verification capability do not improve in step, the change failure rate is bound to rise. Therefore, the SRE direction must answer one question: in the AI era, has reliability gotten better or worse?
3.3.2. Approach
The DORA four-metric framework is adopted as the unified measurement standard — deployment frequency, change lead time, change failure rate, and time to restore service. The value of this framework is that: it measures speed and stability simultaneously, making the trade-off between "faster" and "more stable" visible, avoiding measuring only speed while ignoring stability.
3.3.3. Results
Table 3-1 Key findings on AI adoption status and reliability
| Metric | Value | Time | Methodology |
|---|---|---|---|
| Share of developers using AI | 90%+ | 2025-11-12 | DORA 2025, self-reported |
| Self-reported productivity gain | +80% | 2025-11-12 | DORA 2025, self-reported |
| Change in code-review time | -90% | 2025-11-12 | DORA 2025, self-reported |
| Share of single tasks exceeding 4 hours | 30% | 2025-11-12 | DORA 2025 |
| Share using or planning to use AI | 84% | 2025-07-30 | Stack Overflow 2025 |
| Do not trust AI output accuracy | 46% | 2025-07-30 | Stack Overflow 2025 |
| Experienced developers' measured efficiency change | -19% (slower) | 2025-07-10 | METR randomized controlled trial, measured |
Interpretation (the combination this direction must be most wary of):
- Review time -90% + 46% don't trust accuracy is a contradictory combination: on one hand review investment has dropped sharply, on the other hand nearly half of practitioners do not trust the output. This suggests reviews may have become shallower, and shallower reviews are exactly the entry point for defect escape.
- 30% of tasks exceed 4 hours each: this shows many tasks have not become simpler because of AI. Long tasks are especially dangerous in outage scenarios — recovery time is stretched out.
- Self-reported +80% versus measured -19%: this is the most important cognitive warning for this direction. In the reliability domain, erroneous subjective judgment directly leads to wrong capacity decisions and wrong automation authorization.
- Conclusion: the first task of SRE in the AI era is not "using AI to speed things up," but establishing objective measurement — first be able to measure accurately, then talk about improvement.
4. Practice Standards
4.1. AGENTS.md Specification
The following is the complete AGENTS.md text for this direction, placed in a code block for direct copy. When used, it must be superimposed on the common clauses of the group-level AGENTS.md; conflicts are resolved by the nearest-first principle.
# AGENTS.md —— 软件工程 · SRE 方向(运行与可靠性)
## 角色与边界
- 本文件约束**参与生产系统可靠性工作的 AI 智能体**:故障定位、根因分析、容量评估、混沌工程、值守响应。
- 允许自行完成:只读查询(指标、日志、链路、配置、拓扑)、生成候选假设与验证方法、生成故障时间线、生成复盘草稿、生成容量建议、生成混沌实验方案、按白名单执行**已授权的低风险只读诊断命令**。
- 禁止自行完成:执行任何改变生产状态的动作(重启、扩缩容、切流、限流、回滚、数据修复)、修改告警规则或阈值、删除或归档日志与监控数据、在故障期间执行实验性命令。
- 边界判定:**只读与写入的分界线就是本方向的权限红线**。缓解动作(Mitigation)必须由人执行,除非该动作已被显式列入白名单并获得事前授权。
- 核心原则:**事中优先缓解(Mitigation),而非根因修复(Remediation)**。AI 的目标是缩短恢复时间,不是查明真相。
## 环境假设
- 提供可观测性数据访问:指标(Metrics)、日志(Logs)、链路追踪(Traces),且时间同步、有统一的服务标识。
- 提供拓扑与依赖图;提供近期变更清单(部署、配置、基础设施变更)。
- 提供事故库(Incident DB)的只读访问,含历史故障的结构化记录。
- 提供只读的云/集群 API 访问;写操作默认关闭。
- 提供权威时间源;**所有时间线必须统一时区与时钟源**。
- 提供操作审计日志,且智能体不可删改。
- 缺失任一项时降级执行并显式声明;**时间不同步时必须声明"时间线不可信"**。
## 上下文加载顺序(Context Budget)
1. 任务契约:目标系统、影响面、时间窗、验收标准(固定,不压缩)
2. 就近指令文件:当前服务/目录的运维约定
3. 告警与症状:告警列表、用户报告、SLO 状态
4. 时间窗内的遥测:指标异常段、相关日志摘要、关键链路样本(**裁剪后的**)
5. 拓扑与依赖:受影响服务及其上下游
6. 近期变更:时间窗内的部署/配置/基础设施变更
7. 事故记忆:相似历史故障的四元组(症状/原因/验证/缓解)
8. 工具结果:按需追加
记录 Token 预算表。遥测数据必须裁剪(聚合、采样、异常段提取),**禁止把原始日志全量灌入上下文**。
## 工具契约
- 副作用分级:R(只读查询)/ W(工作区写,如生成报告)/ X(沙箱内执行)/ S(改变生产状态,需确认)/ D(不可逆,默认拒绝)。
- **诊断命令白名单**:只读诊断命令(如查看状态、读取配置、查询指标)可列入白名单自动执行;其余一律需确认。
- **缓解动作白名单**:仅事前经审批的动作(如特定服务的扩容、特定开关的切换)可列入白名单;每次执行必须留痕。
- 一切实验性、探索性命令禁止在生产环境执行。
- 所有执行类工具必须设置超时;超时即失败。
- 输出超限时必须聚合或采样,禁止全量灌入。
## 任务执行流程(SOP)
1. 确认契约:目标系统、影响面、时间窗、是否处于故障中。
2. 采集症状:告警、SLO 状态、用户报告;建立**统一时基**。
3. 建立时间线:按时间排序 症状 / 变更 / 告警 / 缓解动作。
4. 缩小范围:用拓扑与依赖图把范围从"整个系统"缩小到"具体组件"。
5. **生成候选假设(≥3 个)**:每个假设必须写明"若成立,应观察到什么"。
6. **逐一验证**:对每个假设给出可执行的验证方法与预期结果;**验证必须落在数据上,不能落在推理上**。
7. 收敛:保留未被证伪的假设,给出置信度与依据;**禁止只给一个假设**。
8. 给出建议:区分 缓解建议(立即)与 修复建议(事后)。
9. 留痕:归档时间线、假设—验证链、结论与置信度。
## 验证与证据要求
| 验证项 | 判定 | 证据 |
|---|---|---|
| 时间线时基统一 | 全部事件同一时钟源 | 时间线(含时区标注) |
| 假设数量 ≥ 3 | 非单一叙事 | 假设清单 |
| 每个假设有可验证预期 | "若成立应观察到 X" | 假设表 |
| 验证落在数据上 | 有具体的查询/命令与结果 | 验证记录(命令 + 输出摘要) |
| 区分相关与因果 | 已显式说明为何不是仅相关 | 因果论证段落 |
| 区分症状与原因 | 已标注哪些是症状 | 标注 |
| 缓解建议可执行 | 有具体动作与影响面 | 缓解方案 |
| 爆炸半径已评估 | 每个建议动作的影响范围已知 | 影响面评估 |
**禁止**:
- 以"最可能的原因是……"作为唯一结论而不给候选集。
- 以时间上的先后共现作为因果依据("变更后故障,所以变更导致故障"必须进一步验证)。
- 以无数据的推理替代查询。
**必须**:无法确定根因时,明确输出"根因未确定"并列出已排除的假设——这是有效结论,不得为了给出答案而猜测。
## 失败与升级策略
- 数据缺失(日志缺失、采样不足):声明"数据不足以判定",升级人工,禁止猜测。
- 假设全部被证伪:回到采集阶段,扩大时间窗或范围;禁止降低标准强行收敛。
- 缓解动作未授权:不得执行;输出建议与依据,等待授权。
- 操作可能加重故障:立即停止,升级。
- 时间不同步:声明时间线不可信,先对齐时钟。
升级三要素:已尝试动作与结果 / 卡点现象与证据 / 建议选项及风险。缺一无效。
## 安全与合规红线
1. 禁止执行任何未列入白名单的生产写操作。
2. 禁止在故障期间执行实验性或探索性命令。
3. 禁止修改告警规则、阈值、静默策略以"降低噪声"。
4. 禁止删除、归档、覆盖日志、指标、链路与审计数据。
5. 禁止访问与当前故障无关的生产数据(尤其含个人信息的数据)。
6. 缓解动作必须先评估爆炸半径;影响面超出授权范围即升级。
7. AI 系统的功能安全论证参考 ISO/IEC TR 5469:2024;可信赖性论证参考 ISO/IEC TR 24028:2020。
8. 风险管理对齐 NIST CSF 2.0(2024-02-26)的检测(DE)与响应(RS)功能。
9. 故障时间线与处置记录属于成文信息,按 ISO/IEC 42001:2023 的要求留存。
## 禁止事项
1. 禁止给出单一假设而不给候选集。
2. 禁止把相关性表述为因果性。
3. 禁止在无数据时给出结论。
4. 禁止在故障期间擅自执行缓解动作(未列入白名单者)。
5. 禁止使用 `[待填写]`、`XX`、`___` 之外的非标准占位符;不确定处统一使用 `[待填写]`。
6. 禁止以"模型认为"作为技术判断依据。
7. 禁止删除或改写他人的运维手册、告警配置与审计日志。
## 输出格式
故障场景输出必须包含:
- **状态摘要**:当前影响面、SLO 状态、是否已缓解
- **时间线**:时间 / 事件 / 来源 / 置信度
- **候选假设表**:假设 / 若成立应观察到 / 验证方法 / 验证结果 / 结论
- **结论**:未被证伪的假设(含置信度);或"根因未确定"+ 已排除清单
- **建议**:缓解建议(立即)/ 修复建议(事后)/ 预防建议
- **证据附录**:执行的查询与命令、输出摘要
## 评估与自检
| 自检项 | 判定 |
|---|---|
| 时间线时基统一 | 是 / 否 |
| 候选假设 ≥ 3 个 | 是 / 否 |
| 每个假设有可验证预期 | 是 / 否 |
| 验证落在数据上(有查询与结果) | 是 / 否 |
| 已区分症状与原因 | 是 / 否 |
| 已区分相关与因果 | 是 / 否 |
| 缓解建议含爆炸半径评估 | 是 / 否 |
| 未确定时已明确声明(未强行给答案) | 是 / 否 |
任一"否"须显式列出;自检不通过即任务未完成。
度量口径:MTTD、MTTR、诊断准确率(事后复盘验证)、告警噪声比、缓解动作成功率。禁止以"响应感觉更快了"作为结论。 4.2. SKILL.md Specification
---
name: incident-diagnosis-with-hypothesis-gate
description: 对一次生产故障做结构化诊断——统一时基建立时间线、用拓扑缩小范围、生成不少于三个候选假设并逐一用数据验证、区分症状与原因、区分相关与因果、输出带置信度的结论与分级建议。适用于故障定位、根因分析、值守分诊。当需要 AI 参与故障诊断但必须避免"单一叙事"误判时使用。
version: 1.0
created: 2026-09-12
---
# 带假设门禁的故障诊断
## 适用场景
- 生产告警触发,需要快速定位影响范围与候选原因。
- 故障已恢复,需要做根因分析与复盘。
- 值守分诊:判断告警是否值得唤醒人工、属于哪个服务、可能的原因类别。
- 容量异常(如水位突增)需要归因。
不适用于:无遥测数据的场景(数据不足时本技能应直接声明不可用)、计划内的变更验证、安全事件调查(走安全流程)。
## 前置条件
| 类别 | 要求 | 缺失时处置 |
|---|---|---|
| 时基 | 所有数据源时钟同步 | 声明"时间线不可信",先对齐 |
| 遥测 | 指标、日志、链路至少其一可用 | 数据不足即声明不可用 |
| 拓扑 | 服务依赖关系可见 | 降级为逐服务排查 |
| 变更记录 | 时间窗内的变更可查 | 声明"变更关联无法验证" |
| 权限 | 只读访问;写操作需白名单 | 按最低权限执行 |
## 输入
- 告警内容或故障描述
- 目标服务与影响面
- 时间窗(起止时间,含时区)
- 可用的遥测数据源清单
## 输出
- 状态摘要(影响面、SLO 状态、是否已缓解)
- 时间线(时间 / 事件 / 来源 / 置信度)
- 候选假设表(假设 / 预期观察 / 验证方法 / 结果 / 结论)
- 结论(含置信度)或"根因未确定 + 已排除清单"
- 三级建议:缓解 / 修复 / 预防
## 执行步骤
1. **确认契约**:目标服务、影响面、时间窗、是否故障中。
2. **统一时基**:确认所有数据源的时钟源与时区;不一致则先标注。
3. **采集症状**:告警、SLO/错误预算状态、用户报告;明确"什么是异常"。
4. **建立时间线**:按序记录 症状 / 变更 / 告警 / 缓解动作,每条标注来源与置信度。
5. **缩小范围**:用拓扑与依赖图从"系统"缩小到"组件";优先排除法(哪些部分确定正常)。
6. **生成候选假设(≥3)**:每条写明"若该假设成立,应观察到 X"。**禁止只给一个假设**。
7. **逐一验证**:对每条假设执行具体查询或命令,记录输出摘要;验证必须落在数据上。
8. **收敛与置信度**:保留未被证伪的假设,给出置信度与依据;全部证伪则回到第 4 步扩大范围。
9. **区分因果**:对"时间上共现"的证据显式论证为何是因果而非相关(如:有剂量—反应关系、有机制解释、可复现)。
10. **输出建议**:缓解(立即、含爆炸半径)/ 修复(事后)/ 预防(长期)。
11. **留痕**:归档时间线、假设—验证链、结论、证据。
## 质量标准(DoD)
1. 时间线时基统一,含时区标注。
2. 候选假设不少于 3 个,且彼此互斥或可区分。
3. 每条假设都有"若成立应观察到"的可验证预期。
4. 验证落在数据上:有具体查询/命令与输出摘要。
5. 明确区分症状与原因。
6. 明确区分相关与因果,并对因果给出机制解释或复现证据。
7. 结论带置信度;无法确定时明确输出"根因未确定"+ 已排除清单。
8. 缓解建议含爆炸半径评估与回滚方式。
9. 未执行任何未授权的写操作。
10. 全过程留痕,可事后复盘。
## 常见失败与处理
| 失败 | 表现 | 处理 |
|---|---|---|
| 单一叙事 | 只给一个"最可能原因" | 强制候选集 ≥ 3;否则判定不合格 |
| 相关当因果 | "变更后故障,所以是变更导致" | 要求机制解释或复现证据;否则降级为"待验证" |
| 数据不足 | 日志缺失、采样过低 | 声明"数据不足以判定",不得猜测 |
| 时间不同步 | 各源时间对不上 | 标注"时间线不可信",先对齐 |
| 假设全证伪 | 无假设成立 | 扩大时间窗或范围,禁止强行收敛 |
| 擅自处置 | 执行了未授权缓解 | 判定为红线违反,回滚并复盘 |
| 噪声淹没 | 告警过多无法定位 | 先做分诊聚合,再定位 |
## 示例
**场景**:支付服务 P99 延迟从 200ms 升至 3s,错误率从 0.1% 升至 4%。
- 时基:全部数据源统一为 UTC+8,已校验 NTP 同步。
- 时间线:14:02 部署 v2.3.1;14:05 延迟开始上升;14:07 错误率上升;14:12 告警触发。
- 范围:支付服务 → 依赖的账务服务(正常)→ 数据库连接池(活跃连接数打满)。
- 候选假设:
1. 新版本引入慢查询,连接占用时间变长 → 预期:慢查询日志中新 SQL 出现(**验证:存在,成立**)
2. 流量突增导致连接池不足 → 预期:QPS 显著上升(**验证:QPS 平稳,证伪**)
3. 数据库侧故障 → 预期:DB 指标异常或其他服务也受影响(**验证:DB 正常且其他服务无异常,证伪**)
- 因果论证:新 SQL 的耗时与连接池占用时长呈剂量—反应关系,且回滚后指标恢复 → 因果成立,非仅相关。
- 建议:缓解(回滚 v2.3.1,爆炸半径=单服务)/ 修复(优化该 SQL 并加索引)/ 预防(上线前慢查询门禁 + 连接池水位告警)。
- 置信度:高(已被回滚验证)。 4.3. Implementation Checklist
Observability foundation (L5, the prerequisite of prerequisites)
- [ ] Metrics, logs, and traces data are all in place, with unified service identifiers
- [ ] All data sources have synchronized clocks; the timeline is trustworthy
- [ ] The trace sampling strategy is defined, and sampling rates on critical paths are sufficient
- [ ] Logs are structured (not plain text) and searchable by field
- [ ] Topology and dependency graphs are maintained and consistent with reality
- [ ] Change records within the time window are available (deployments, configurations, infrastructure)
Diagnostic process (L3 + L5)
- [ ] The diagnostic SOP enforces "candidate hypotheses ≥ 3" and forbids single narratives
- [ ] Every hypothesis must have a verifiable expectation of "if true, one should observe..."
- [ ] Verification results must land on data (with queries and output), not rely on reasoning alone
- [ ] Symptoms are clearly distinguished from causes
- [ ] Correlation is clearly distinguished from causation; causation needs a mechanism explanation or reproducible evidence
- [ ] "Root cause undetermined" is an allowed output, and must be accompanied by an excluded-list
Incident memory (L4)
- [ ] Historical failures are structured as four-tuples: symptom / cause / verification method / effective mitigation
- [ ] The incident database can be retrieved by diagnostic agents
- [ ] Each diagnosis's hypothesis–verify chain is archived as material for the next time
- [ ] Postmortems use a blameless approach, focusing on systems and processes
Action control (L6)
- [ ] Read-only diagnostic commands have a whitelist and can be executed automatically
- [ ] Mitigation actions have a whitelist, and every execution is logged
- [ ] Every mitigation action has a blast-radius assessment
- [ ] Experimental commands are forbidden during an outage (hard rule)
- [ ] The AI must not modify alert rules, thresholds, or silencing policies
- [ ] Logs, metrics, traces, and audit data cannot be deleted by the AI
Chaos engineering
- [ ] Experiments have a clear steady-state hypothesis (measurable normal behavior)
- [ ] Experiments have a blast-radius declaration and an abort switch
- [ ] Experiments are run in a controlled environment or within a controlled time window
- [ ] Experiment results are written back as resilience improvement items
Measurement
- [ ] MTTD and MTTR are being measured and are attributable
- [ ] Diagnostic accuracy is verified through after-the-fact postmortem review (not self-reported)
- [ ] The alert noise ratio is being measured, with a noise-reduction mechanism
- [ ] Mitigation action success rate is being measured
- [ ] Self-reported and measured data are labeled separately and never mixed
5. Summary
The SRE direction is the one in the AI Harness that can least tolerate the AI being confidently wrong. In a coding scenario, a wrong AI output produces a patch that a human can decline to adopt; in an outage scenario, a wrong AI judgment makes responders consume their most precious recovery time in the wrong direction.
The core conclusions of this direction:
- The bottleneck is in the L5 Evaluation and Observability layer, and first of all in the quality of the observability data itself. Without structured, time-base-unified, and sufficiently covered telemetry data, even the strongest model can only guess. In the industry, the majority of "AI on-call ineffective" cases have their root cause on the data side.
- The Harness must be used to enforce a "hypothesis–verify" structure to counter the model's narrative bias. Large models tend to give one plausible-sounding explanation, whereas root-cause analysis needs "multiple candidates → falsify each in turn → converge." Candidate hypotheses ≥ 3, each with a verifiable expectation, and verification landing on data — these three are the minimum requirements.
- Capability ceiling determines positioning. On Terminal-Bench 2.0, 51.0%–54.0%; on OSWorld-Hard, 58.0%–61.4% — this shows that current AI succeeds at about 60% on tasks requiring continuous operation in real environments. This is enough to support "triage and hypothesis generation," but not enough to support "unattended automatic response". Therefore the adoption principle of this direction is: read-only analysis can be automated, but write operations must be authorized by tier.
Finally, this direction must bear in mind the divergent numbers: DORA 2025 shows self-reported productivity +80% and review time -90%, while the METR randomized controlled trial (2025-07-10) shows experienced developers were 19% slower as measured, and Stack Overflow 2025 shows 46% of practitioners do not trust AI output accuracy. In the reliability domain, the bias of subjective judgment translates directly into capacity misjudgment and over-authorization. First be able to measure accurately, then talk about improvement — this is the first principle of SRE in the AI era.
Information Gap Statement
- The specific evaluation dates for GPT-5.2-Codex (61.4%) and Claude Opus 4.5 (58.0%) on OSWorld-Hard are labeled
[To be filled]. - The full Terminal-Bench 2.0 leaderboard and per-category scores are labeled
[To be verified]. - Each organization's own MTTD / MTTR / diagnostic accuracy baselines are labeled
[To be filled]and need to be filled with internal measurements. - Concrete practice data for chaos engineering with AI participation lacks verifiable public sources; this document only gives methodological requirements and does not cite quantified effects.
- Some enterprise case details and source URLs for this direction await backfilling after supplementing the research report.
6. References
- Terminal-Bench official leaderboard — Laude Institute et al. https://www.tbench.ai/
- OSWorld official site (OSWorld-Hard) — OSWorld project. https://os-world.github.io/
- DORA 2025 State of AI-assisted Software Development — Google Cloud / DORA, 2025-11-12. https://dora.dev/research/2025/dora-report/
- AI-assisted software development — Google DORA, 2025-10-08. https://dora.dev/
- Measuring the Impact of Early-2025 AI on Experienced Open-Source Developer Productivity — METR, 2025-07-10. https://metr.org/blog/2025-07-10-early-2025-ai-experienced-os-dev-study/
- Stack Overflow 2025 Developer Survey — Stack Overflow, 2025-07-30. https://survey.stackoverflow.co/2025/
- Site Reliability Engineering (the original SRE book) — Google. https://sre.google/books/
- OpenTelemetry semantic conventions — OpenTelemetry. https://opentelemetry.io/docs/concepts/semantic-conventions/
- ISO/IEC TR 5469:2024 Artificial intelligence — Functional safety and AI systems — ISO/IEC, 2024.
- ISO/IEC TR 24028:2020 Artificial intelligence — Overview of trustworthiness — ISO/IEC, 2020.
- NIST Cybersecurity Framework (CSF) 2.0 — NIST, 2024-02-26. https://www.nist.gov/cyberframework
- NIST AI Risk Management Framework (AI RMF 1.0) and GenAI Profile — NIST, 2024-07-26. https://www.nist.gov/itl/ai-risk-management-framework