修复: aichat P2确定性bug批(audit吞错落日志+switch/delete占位终态化)

finalize: audit_tool_call insert 用 let _ = 吞 DB 错改 match Err tracing::error(对齐 audit_finalize:82模式,控制流不变不阻断,审计写失败落日志可确诊)
conversation+chat: switch/delete retain pending 前补 finalize_pending_placeholders 占位终态化(对齐 stop/clear/force_send,防占位 tool_result 残留下次发送喂 LLM);chat.rs finalize_pending_placeholders 可见性 fn→pub(crate)
cargo check --workspace 零错
This commit is contained in:
2026-06-24 17:18:54 +08:00
parent 7f6aa1e782
commit a7dbd50a4d
3 changed files with 20 additions and 3 deletions

View File

@@ -32,7 +32,7 @@ pub(crate) async fn audit_tool_call(
message_id: Option<&str>,
) {
let executed_at = if decided_by.is_some() { Some(now_millis()) } else { None };
let _ = repo
if let Err(e) = repo
.insert(AiToolExecutionRecord {
id: new_id(),
conversation_id: Some(conv_id.to_string()),
@@ -51,7 +51,16 @@ pub(crate) async fn audit_tool_call(
executed_at,
decided_by: decided_by.map(|s| s.to_string()),
})
.await;
.await
{
tracing::error!(
"audit_tool_call: 写审计记录失败(conv={}, tool_call_id={}, tool={}): {}",
conv_id,
tool_call_id,
tool_name,
e
);
}
}
/// 审批后更新审计记录状态(按 tool_call_id 定位 pending 记录,回填 status/decided_by=human/executed_at/result