From 33eafbad5198d9fe64ff507ac673430ec334b4aa Mon Sep 17 00:00:00 2001 From: Cherilyn Buren <88433283+NiuBlibing@users.noreply.github.com> Date: Thu, 4 Jun 2026 11:29:25 +0800 Subject: [PATCH] =?UTF-8?q?fix(copilot):=20=E8=B0=83=E9=AB=98=E6=97=A0?= =?UTF-8?q?=E9=99=90=E7=A9=BA=E7=99=BD=E6=A3=80=E6=B5=8B=E9=98=88=E5=80=BC?= =?UTF-8?q?=2020=20=E2=86=92=20500=20(#2647)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(copilot): raise infinite-whitespace threshold from 20 to 500 The previous threshold of 20 falsely aborted legitimate tool calls whose arguments contain indented code (write_file / edit_file with 4-8 levels of indentation in Python / YAML / Rust / Markdown easily exceed 20 consecutive whitespace chars, especially when newlines are counted). The real infinite-whitespace bug emits hundreds to thousands of consecutive whitespace characters, so 500 keeps the safety net while drastically reducing false positives. Refs #2646 Co-Authored-By: Claude Opus 4.7 (1M context) * docs: clarify whitespace threshold comment --------- Co-authored-by: Claude Opus 4.7 (1M context) Co-authored-by: Jason --- src-tauri/src/proxy/providers/streaming.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src-tauri/src/proxy/providers/streaming.rs b/src-tauri/src/proxy/providers/streaming.rs index c69e78496..150d29f99 100644 --- a/src-tauri/src/proxy/providers/streaming.rs +++ b/src-tauri/src/proxy/providers/streaming.rs @@ -90,14 +90,14 @@ struct ToolBlockState { started: bool, pending_args: String, /// 连续空白字符计数 — 用于检测 Copilot 无限换行 bug - /// 当 function call 参数中出现连续 20+ 空白字符时,强制终止流 + /// 当 function call 参数中的连续空白字符达到阈值时,强制终止流 consecutive_whitespace: usize, /// 是否已因无限空白 bug 被中止 aborted: bool, } /// 无限空白 bug 的连续空白字符阈值 -const INFINITE_WHITESPACE_THRESHOLD: usize = 20; +const INFINITE_WHITESPACE_THRESHOLD: usize = 500; fn build_anthropic_usage_json(usage: &Usage) -> Value { let mut usage_json = json!({