A Note from the User
This is a message from me, a human user. I asked AI to handle the rest of the issue report.
I tried to patch the problems I encountered while using Zoo Code myself. The patches may be incomplete or may not work correctly. Please, the bug fix team, judge them directly. I hope Zoo Code continues to grow and mature.
Problem
When the model generates a response longer than 8,000 characters, tool call XML tags appear as raw text in the chat output instead of being parsed as tool calls. The 8KB guard in extension.js disables tool-call detection after the buffer exceeds 8,000 characters.
Context
- OS: Windows 11, PowerShell 5.1
- Zoo Code Version: v3.63.100188
- Model: mimo-v2.5-pro
- Trigger: Responses exceeding 8,000 characters
Reproduction Steps
- Ask the model a complex question requiring a long response (8,000+ characters)
- Model generates tool call XML within the response
- XML tags appear as raw text in the chat instead of being parsed as tool calls
Expected Result
Tool call XML should be parsed and executed, with only regular text displayed in chat.
Actual Result
Tool call XML tags appear as raw text in the chat. Here are actual examples from diagnostics:
Example 1: Truncated function tag displayed as text
Example 2: Parameter tags with file paths displayed as text
<parameter=path>c:\\Users\\myuser\Projects\\MyProject
Example 3: Mixed text and XML fragments in a single content block
<parameter=path>C:\Users\developer\projects\\myownsettings
<parameter=timeout>180</parameter>
</function>
</invoke>
Root Cause
The bug is in extension.js line 5369, inside the case"text": branch of the stream consumer switch:
- Buffer accumulation:
D += q.text accumulates all text chunks into a module-scoped variable D across the entire stream lifetime.
- 8KB hard cutoff:
if (D.length < 8e3 && __detect.test(D)) - the XML tool-call detection logic is completely disabled when D exceeds 8,000 characters.
- Raw XML passthrough: Once
D exceeds 8KB, the __detect.test(D) branch is skipped entirely. Subsequent text chunks containing XML markers are pushed directly into assistantMessageContent as plain text.
- Cross-chunk contamination: File paths like
1yt/Projects/ZooChat are fragments from parameter tags that leaked into chat text rendering.
Impact
| Aspect |
Impact |
| User Visibility |
Raw XML tags displayed in chat |
| UX Degradation |
Sentence breaks, trailing text contamination |
| Reproduction Rate |
100% when model output exceeds 8KB |
| Affected Models |
All XML-style tool-call models (mimo-v2.5-pro and others) |
Proposed Fix
Recommended: Remove 8KB guard + add buffer size cap
Remove the D.length < 8e3 guard and replace with a 64KB memory protection cap:
- Remove the 8000-character hard cutoff from the XML detection condition
- Add a 65536-byte (64KB) cap on the accumulation buffer
D
- When
D exceeds 64KB, reset it (existing memory protection behavior)
- Keep the existing v7 tool-call extraction logic unchanged
Advantages: Enables tool-call detection at all response lengths. Memory protection handled by separate 64KB cap.
A Note from the User
This is a message from me, a human user. I asked AI to handle the rest of the issue report.
I tried to patch the problems I encountered while using Zoo Code myself. The patches may be incomplete or may not work correctly. Please, the bug fix team, judge them directly. I hope Zoo Code continues to grow and mature.
Problem
When the model generates a response longer than 8,000 characters, tool call XML tags appear as raw text in the chat output instead of being parsed as tool calls. The 8KB guard in
extension.jsdisables tool-call detection after the buffer exceeds 8,000 characters.Context
Reproduction Steps
Expected Result
Tool call XML should be parsed and executed, with only regular text displayed in chat.
Actual Result
Tool call XML tags appear as raw text in the chat. Here are actual examples from diagnostics:
Example 1: Truncated function tag displayed as text
Example 2: Parameter tags with file paths displayed as text
Example 3: Mixed text and XML fragments in a single content block
Root Cause
The bug is in
extension.jsline 5369, inside thecase"text":branch of the stream consumer switch:D += q.textaccumulates all text chunks into a module-scoped variableDacross the entire stream lifetime.if (D.length < 8e3 && __detect.test(D))- the XML tool-call detection logic is completely disabled whenDexceeds 8,000 characters.Dexceeds 8KB, the__detect.test(D)branch is skipped entirely. Subsequent text chunks containing XML markers are pushed directly intoassistantMessageContentas plain text.1yt/Projects/ZooChatare fragments from parameter tags that leaked into chat text rendering.Impact
Proposed Fix
Recommended: Remove 8KB guard + add buffer size cap
Remove the
D.length < 8e3guard and replace with a 64KB memory protection cap:DDexceeds 64KB, reset it (existing memory protection behavior)Advantages: Enables tool-call detection at all response lengths. Memory protection handled by separate 64KB cap.