Bug in agent_loop.py — _clean_content function
In _clean_content, the following loop is used:
for p in [r'<file_content>[\s\S]*?</file_content>', r'<tool_(?:use|call)>[\s\S]*?</tool_(?:use|call)>', r'(\r?\n){3,}']:
text = re.sub(p, '\n\n' if '\\\\n' in p else '', text)
The condition '\\\\n' in p is checking for a 3-character string (\\n: backslash, backslash, n) inside the third pattern r'(\r?\n){3,}', which only contains the 2-character sequence \n (backslash, n).
Because this check is always False for the third pattern, 3+ consecutive newlines are deleted entirely (replaced with '') instead of being condensed to two newlines ('\n\n').
This causes all paragraph spacing in LLM responses to disappear in non-verbose mode.
Fix
Change '\\\\n' to '\\n' so the condition correctly identifies the newline-collapse pattern:
for p in [r'<file_content>[\s\S]*?</file_content>', r'<tool_(?:use|call)>[\s\S]*?</tool_(?:use|call)>', r'(\r?\n){3,}']:
text = re.sub(p, '\n\n' if '\\n' in p else '', text)
Signed-off-by: Cocoon-Break 54054995+kuishou68@users.noreply.github.com
Bug in
agent_loop.py—_clean_contentfunctionIn
_clean_content, the following loop is used:The condition
'\\\\n' in pis checking for a 3-character string (\\n: backslash, backslash, n) inside the third patternr'(\r?\n){3,}', which only contains the 2-character sequence\n(backslash, n).Because this check is always
Falsefor the third pattern, 3+ consecutive newlines are deleted entirely (replaced with'') instead of being condensed to two newlines ('\n\n').This causes all paragraph spacing in LLM responses to disappear in non-verbose mode.
Fix
Change
'\\\\n'to'\\n'so the condition correctly identifies the newline-collapse pattern:Signed-off-by: Cocoon-Break 54054995+kuishou68@users.noreply.github.com