diff --git a/crates/df-ai/src/context/sanitize.rs b/crates/df-ai/src/context/sanitize.rs index a34eccc..3017e3e 100644 --- a/crates/df-ai/src/context/sanitize.rs +++ b/crates/df-ai/src/context/sanitize.rs @@ -142,7 +142,8 @@ pub fn sanitize_messages(messages: Vec) -> Vec { }) .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) -> Vec { } 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) -> Vec { fixed.push(m); } if skipped > 0 || merged > 0 { - tracing::warn!( + tracing::debug!( skipped, merged, "序列修复:skip 开头非 user(含连带丢 orphan result)+ 合并连续同 role(view-only,避免 Anthropic/GLM 1214)" diff --git a/crates/df-ai/src/openai_compat.rs b/crates/df-ai/src/openai_compat.rs index 85508a5..2b8941b 100644 --- a/crates/df-ai/src/openai_compat.rs +++ b/crates/df-ai/src/openai_compat.rs @@ -424,7 +424,7 @@ fn sanitize_openai_triplets(messages: &mut Vec) { // 无配对头(id 不在任何保留 assistant 头内)→ orphan tool_result,丢弃。 // 含两类:(a) assistant 头被 step2 剥后残留的 tool;(b) 全程无配对头的直构造/DB 残留。 dropped_orphan_tools += 1; - tracing::warn!( + tracing::debug!( tool_call_id = %id, "[openai] orphan tool result(无配对 assistant tool_calls),已丢弃(防 'tool must be response to preceding tool_calls' 400)", ); @@ -432,7 +432,7 @@ fn sanitize_openai_triplets(messages: &mut Vec) { }); if stripped_heads > 0 || dropped_orphan_tools > 0 { - tracing::warn!( + tracing::debug!( stripped_heads, total_stripped, dropped_orphan_tools,