From 0633aa6614ba1bc0259950722268ec2e576aa865 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BB=9D=E5=B0=98?= <237809796@qq.com> Date: Wed, 17 Jun 2026 14:10:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96:=20todo=E9=94=80=E8=B4=A6(BU?= =?UTF-8?q?G-260617-01=E8=AF=AF=E5=88=A4=C2=B7=E5=8D=95=E6=B5=8B=E8=AF=81?= =?UTF-8?q?=E4=BF=9D=E5=AE=88=E8=AE=BE=E8=AE=A1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/todo.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/todo.md b/docs/todo.md index 01c2edd..1e9aede 100644 --- a/docs/todo.md +++ b/docs/todo.md @@ -1089,7 +1089,7 @@ gap: 8px; #### 🔴 P0 — 确定性 Bug(3 项·建议立即修复) -- [ ] **BUG-260617-01 [P0]** — **`classify_status_or_class` 尾部 `|| true` 导致所有 unknown 错误标记 retryable** — `stream_recv.rs:433` 函数末尾硬编码 `|| true`,400/403 等 Fatal 错误被误标为可重试 → agentic loop 无效重试循环浪费 token 和时间。**修法**:移除 `|| true`,unknown 默认 `false`(保守不重试),与 `retry::is_status_retryable` 语义一致。**一行改动,零风险,最高 ROI**。— src-tauri/src/commands/ai/stream_recv.rs:433 +- [x] ✅(误判销账·主代核验06-17) **BUG-260617-01 [P0]** — **`classify_status_or_class` 尾部 `|| true`** 【误判:单测 classify_unknown_retryable(stream_recv.rs:474-478)明确断言 unknown→retryable=true,注释「保守可重试不误判 Fatal 错杀」是有意设计;400/403 走数字码 :424 is_status_retryable 返 false(classify_4xx_fatal:460-465 验证),`|| true` 仅影响纯文本 unknown 分支。按 todo 修(改 false)会破坏单测。审查报告把保守设计当 bug】 — `stream_recv.rs:433` 函数末尾硬编码 `|| true`,400/403 等 Fatal 错误被误标为可重试 → agentic loop 无效重试循环浪费 token 和时间。**修法**:移除 `|| true`,unknown 默认 `false`(保守不重试),与 `retry::is_status_retryable` 语义一致。**一行改动,零风险,最高 ROI**。— src-tauri/src/commands/ai/stream_recv.rs:433 - [x] **BUG-260617-02 [P0]** — **`file_info` 全量读大文件到内存再截断前 8KB** — `tool_registry.rs:1125-1126` `tokio::fs::read(path)` 将整个文件读入内存(注释说">2MB跳过避免全量读"但实际先全量读再取前 8192 字节做二进制检测)。>2MB 文件触发 OOM 风险。**修法**:用 `File::open` + `read_exact()` 仅读前 N 字节,或加 `.take(8192)` 截断流式读取。— src-tauri/src/commands/ai/tool_registry.rs:1125-1126 - [x] **BUG-260617-03 [P0]** — **路径遍历防护可被编码绕过** — `tool_registry.rs:78-95` 只做字符串 `..` 检测 + 小写化,URL 编码 `%2e%2e` / Unicode 同形字符可绕过。**修法**:先 `percent_decode` 再做词法 `..` 分段归一化检查;对不存在路径(new file) 也应规范化校验。— src-tauri/src/commands/ai/tool_registry.rs:78-95