优化: sanitize 告警降级

- 修复告警 warn 降 debug,同份畸形历史每请求重复触发成洪水
- 涉 sanitize.rs 四处与 openai_compat 两处,含逐 orphan 单条刷屏点
- view-only 修复语义不变,存量配对清洗已完成
This commit is contained in:
lxy
2026-10-01 19:36:20 +08:00
parent 1e6db6f310
commit 26d9a1af1e
2 changed files with 7 additions and 6 deletions
+5 -4
View File
@@ -142,7 +142,8 @@ pub fn sanitize_messages(messages: Vec<ChatMessage>) -> Vec<ChatMessage> {
})
.collect();
tracing::warn!(
// debug 级:同份畸形历史每请求重复触发,降级防告警洪水;根治=ai_messages 配对清洗(DB 原始保留不动)
tracing::debug!(
full_drop_heads,
partial_rewrite_heads = partial_heads,
orphaned_tool_results = orphaned_ids.len(),
@@ -252,7 +253,7 @@ pub fn drop_reverse_orphans(messages: Vec<ChatMessage>) -> Vec<ChatMessage> {
}
if healed > 0 || unidentifiable_kept > 0 {
tracing::warn!(
tracing::debug!(
healed_orphan_tool_results = healed,
unidentifiable_tool_results_kept = unidentifiable_kept,
"history sanitized: healed orphan tool_results by inserting placeholder heads (view-only, persisted history untouched)"
@@ -331,7 +332,7 @@ pub fn assert_placeholder_pairing(
out.push(m);
}
if healed > 0 {
tracing::warn!(
tracing::debug!(
healed_orphan_tool_results = healed,
"send-view exit: healed orphan tool_results by inserting TOOL_MISSING_PREFIX heads (view-only, persisted history untouched)"
);
@@ -425,7 +426,7 @@ pub fn ensure_sequence_legal(messages: Vec<ChatMessage>) -> Vec<ChatMessage> {
fixed.push(m);
}
if skipped > 0 || merged > 0 {
tracing::warn!(
tracing::debug!(
skipped,
merged,
"序列修复:skip 开头非 user(含连带丢 orphan result)+ 合并连续同 role(view-only,避免 Anthropic/GLM 1214)"