修复: spawn panic 兜底 + namespace 淘汰提示 + run_command 超时与破坏命令信任门控

This commit is contained in:
lxy
2026-08-01 11:10:28 +08:00
parent 468950616b
commit c4ba920cf5
7 changed files with 145 additions and 11 deletions
@@ -120,8 +120,9 @@ pub(super) async fn maybe_auto_compress(
// T2-修复(方案A):展开 namespace 引用为真实内容,再喂压缩 LLM/关键词摘要。
// 同 agentic/mod.rs 的 build_for_request 出口展开。未展开则压缩 LLM 只看到
// "namespace://..." 占位符,摘要基于占位符丢主题。read_only None(重启后 namespace
// 清空/残留引用)→ 保留占位符降级,非崩溃。
// "namespace://..." 占位符,摘要基于占位符丢主题。read_only None(条目被 LRU 淘汰 /
// 重启后 namespace 清空 / 跨会话残留引用)→ 替换为 EVICTED_PLACEHOLDER 提示文案
// (非保留无意义 namespace:// URI)+ warn 日志。
{
let session = session_arc.lock().await;
for m in &mut active_msgs {
@@ -129,6 +130,13 @@ pub(super) async fn maybe_auto_compress(
let path = m.content.clone();
if let Some(original) = session.namespace_store.read_only(&path) {
m.content = original.to_string();
} else {
tracing::warn!(
conv_id = %conv_id,
path = %path,
"[namespace] 引用已淘汰,替换为提示文案"
);
m.content = df_ai::namespace_store::EVICTED_PLACEHOLDER.to_string();
}
}
}