fix(distill): commit 检出冲突时不进自动蒸馏(conflict guard)

问题:commit 的 DetectContradiction 检出矛盾后只返回 conflicts 字段,
内容仍进 episodes→自动蒸馏→污染 distilled/memories(TencentDB 误判案例根因链一环)

修复:conflicts>0 时跳过 AutoDistillTrigger,返回 distill_skipped=conflict;
处理路径:①写错→feedback not_useful;②旧记忆错→feedback 降权;
③确认为修正→resolve_conflict=true 重 commit(待客户端支持)

验证:commit 矛盾内容 → conflicts 返回 + distill_skipped=conflict 
This commit is contained in:
xiaowei 2026-09-04 01:29:11 +08:00
parent ae73982743
commit 63f123417b
1 changed files with 8 additions and 2 deletions

View File

@ -165,10 +165,16 @@ func (a *API) Commit(w http.ResponseWriter, r *http.Request) {
}
if len(conflicts) > 0 {
respData["conflicts"] = conflicts
// 冲突保护2026-09-03 记忆治理):检出矛盾的内容不进自动蒸馏,
// 避免污染 distilled/memories。episodes 已保留(原始日志可追溯)。
// 处理路径①写错→Hermes feedback not_useful②旧记忆错→feedback 降权;
// ③确认为修正/新事实→客户端显式 resolve_conflict=true 重 commit。
respData["distill_skipped"] = "conflict"
respData["distill_note"] = "conflict detected; auto-distill skipped to prevent memory pollution. Resolve via feedback, or re-commit with resolve_conflict=true if this is a verified correction"
} else {
go AutoDistillTrigger(epID, req.Content, req.Category, req.Namespace, req.AgentID)
}
respond(w, 201, respData)
go AutoDistillTrigger(epID, req.Content, req.Category, req.Namespace, req.AgentID)
}
// mergeMemory 合并重复记忆:升版本、提重要性、更新时间戳