检测到无限空白 bug: Copilot incorrectly drops tool calls containing indented code
Quick fix
A comment reports a fix in commit 33eafbad5198d9fe64ff507ac673430ec334b4aa. Check whether your version includes it; no fixed release was specified.
Symptom
Section titled “Symptom”检测到无限空白 bugInfinite whitespace bug detected
The report states that cc-switch's Copilot streaming logic in src-tauri/src/proxy/providers/streaming.rs checks tool call arguments deltas with a whitespace threshold of 20. Once triggered, state.aborted is set to true and never reset. The entire tool call is silently dropped, leaving only a warning log. Deep code indentation, consecutive whitespace across deltas, JSON formatting whitespace, and Markdown table alignment are listed as potential false positives. The report also claims that newlines and leading indentation can accumulate across lines. However, the code shown resets the counter on non-whitespace characters, so it does not establish that ordinary multiline code necessarily accumulates enough whitespace to trigger the check.
Check whether your version includes commit 33eafbad5198d9fe64ff507ac673430ec334b4aa. A comment explicitly says this commit fixed the issue, but the original thread provides no corresponding release version, specific patch, or retest results.
To verify, have a session routed through Copilot execute write_file to write deeply indented code, such as YAML with 8 indentation levels or nested Python functions. Check whether the tool call is still silently aborted and whether the logs contain “检测到无限空白 bug”.
Treat raising the threshold to 200 or 500, using a whitespace-ratio window, removing detection, and adding a configurable discard policy as proposals from the original thread. The thread does not identify which approach the fix adopted or confirm that a ready-to-use configuration switch exists.
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 1 real issues
(No FAQ yet)
Related problems
Section titled “Related problems”This is an unofficial community wiki with no affiliation to the cc-switch authors or the project itself. Its content is compiled from the project's public GitHub issues. This site distributes no software.