优化: CR-53/54审查回填PASS+CR-55/56/57登记+CR-53-1注释修正(并行化非移锁外)

This commit is contained in:
2026-06-17 02:29:12 +08:00
parent 80c0955a1a
commit 2c8004df65
2 changed files with 58 additions and 18 deletions

View File

@@ -661,10 +661,11 @@ pub(crate) async fn process_tool_calls(
}
}
// AE-04 trust-hit 并行执行execute + 即时 emit 在闭包内(不持 session 锁)
// push tool_result / audit 在 join_all 后串行回填(持锁)。对齐 Low risk 不持锁模式。
// CR-51 修:原 trust-hit 分支 .await execute 时 session 仍 in scope持锁跨整个函数
// run_command 慢命令阻塞同会话所有触 state.ai_session 的 IPC。
// AE-04 trust-hit 并行执行execute + 即时 emit 在闭包内(闭包不访问 session非"锁已释放"——
// session 锁仍由调用方 agentic.rs 持有至 process_tool_calls 返回CR-53 审查纠正原"移锁外"误述),
// push tool_result / audit 在 join_all 后串行回填(持锁)。对齐 Low risk 并行模式。
// CR-51 修:原 inline .await execute 串行执行每个工具阻塞期间锁被持有run_command 慢命令
// 阻塞同会话 IPC改 join_all 并行多工具减少总阻塞时间(锁持有时长不变,并行化降阻塞)。
// join_all 保序——结果顺序 = trust_hits 输入顺序 = tc_list 原始 index 顺序,不额外 sort
if !trust_hits.is_empty() {
let results: Vec<(ToolCallDraft, RiskLevel, Result<String, String>)> =