fix(agent-infra): 腐化诊断修复指引死循环——明示评分基于 git 提交时间

用户按指引"重新生成三件套"两轮无法清除红色诊断:生成只改工作区文件,
而评分比较的是 git 提交时间戳。修复指引现明确要求 commit。
enterprise-system 实测:commit project-context.yaml 后诊断转绿。

Rules-Applied: R11
This commit is contained in:
lanrtop 2026-07-03 08:55:15 +09:00
parent f3b45d55a3
commit 4f5cf431f6
2 changed files with 14 additions and 2 deletions

View File

@ -125,3 +125,15 @@
- depends: C, D - depends: C, D
- files: src-tauri/src/commands/agent_infra.rs, src-tauri/src/lib.rs, src/lib/commands.ts, src/components/dashboard/AgentInfraPanel.tsx - files: src-tauri/src/commands/agent_infra.rs, src-tauri/src/lib.rs, src/lib/commands.ts, src/components/dashboard/AgentInfraPanel.tsx
- acceptance: `get_agent_health(project_path, project_id)` 聚合 infra stack + doc freshness生成问题列表 + Markdown 修正文本AgentInfraPanel 加载时从 cache 读健康徽章,「重新检测 & 生成修正指令」按钮触发完整诊断,结果显示健康状态+可复制 textarea含复制按钮 - acceptance: `get_agent_health(project_path, project_id)` 聚合 infra stack + doc freshness生成问题列表 + Markdown 修正文本AgentInfraPanel 加载时从 cache 读健康徽章,「重新检测 & 生成修正指令」按钮触发完整诊断,结果显示健康状态+可复制 textarea含复制按钮
## 复盘笔记
【陷阱记录】腐化诊断修复指引死循环2026-07-03
任务类型: 前端组件(诊断指引缺陷)
是否返工: 是(用户按指引"重新生成三件套"操作两轮无效)
返工原因: 腐化评分基于 git 提交时间(防"改了不提交"假新鲜,设计正确),但修复指引只说"重新生成"未说"需 commit"——生成动作只改工作区文件git 时间戳不变,诊断永远无法清除,形成指引死循环
有效策略: 修复指引文案显式说明评分依据("必须 git commit 该文件——评分基于 git 提交时间而非文件修改时间"enterprise-system 实测 commit 后转绿
遗留风险: 生成三件套的结果提示未加"记得提交"引导(文案在前端 AgentInfraPanel影响小下次顺手
auto_applied_rules: R11
rule_effectiveness: R11=有效(首次实战触发:诊断建议执行后未解决问题 → 修指引 + 记录失败案例)

View File

@ -846,7 +846,7 @@ pub fn get_agent_health(
issues.push(AgentHealthIssue { issues.push(AgentHealthIssue {
level: "error".into(), level: "error".into(),
title: format!("文档严重腐化:{stale_count} 个契约文件更新超 30 天未同步 project-context.yaml"), title: format!("文档严重腐化:{stale_count} 个契约文件更新超 30 天未同步 project-context.yaml"),
fix: "检查并更新 docs/ai-context/project-context.yaml 的契约描述,或重新生成三件套".into(), fix: "更新或重新生成docs/ai-context/project-context.yaml 后【必须 git commit 该文件】——评分基于 git 提交时间而非文件修改时间,只改不提交无法清除本项".into(),
}); });
overall = "red".to_string(); overall = "red".to_string();
} }
@ -857,7 +857,7 @@ pub fn get_agent_health(
issues.push(AgentHealthIssue { issues.push(AgentHealthIssue {
level: "warn".into(), level: "warn".into(),
title: format!("文档腐化风险:{stale_count} 个契约文件更新后 14-30 天未同步"), title: format!("文档腐化风险:{stale_count} 个契约文件更新后 14-30 天未同步"),
fix: "检查并更新 docs/ai-context/project-context.yaml 中的契约描述".into(), fix: "更新 docs/ai-context/project-context.yaml 中的契约描述并 git commit评分基于提交时间".into(),
}); });
if overall != "red" { if overall != "red" {
overall = "yellow".to_string(); overall = "yellow".to_string();