修复: patch_file 小改动自动放行 + tool_result JSON 压缩 + prompt 项目路径

- C-260627: patch_file ≤5 行自动放行,不阻塞 AI 工作流
- tool_result 压缩: JSON 数组截断到 10 条 + _truncated 标记
- system_prompt: 项目清单增加「目录:」路径信息
This commit is contained in:
2026-06-27 23:59:07 +08:00
parent 6212002270
commit b7b54eb2a6
4 changed files with 38 additions and 2 deletions

View File

@@ -506,11 +506,19 @@ pub(crate) async fn process_tool_calls(
// low(默认):Low→auto, Med/High→审批(等价现状)
// medium:Low/Med→auto, High→审批
// all:全 auto(完全接管,无审批)
let should_auto = match risk_level {
let mut should_auto = match risk_level {
RiskLevel::Low => true,
RiskLevel::Medium => auto_exec_mode == "medium" || auto_exec_mode == "all",
RiskLevel::High => auto_exec_mode == "all",
};
// C-260627: patch_file 小改动(≤5 行)自动放行,不阻塞 AI 工作流
if !should_auto && draft.name == "patch_file" {
if let Some(text) = args.get("new_text").and_then(|v| v.as_str()) {
if text.lines().count() <= 5 {
should_auto = true;
}
}
}
if should_auto {
low_risk.push((draft, args, risk_level));
} else {