Repository navigation
Description
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 calls tools, instead of outputting JSON format, it sometimes outputs XML tags as text. This causes Zoo Code to fail parsing the parameters, resulting in "missing nativeArgs" errors. The search_files tool is most vulnerable (7 out of 11 occurrences).
Context
| Item | Value |
|---|---|
| OS | Windows 11, PowerShell 5.1 |
| Zoo Code Version | v3.63.100188 |
| Model | mimo-v2.5-pro |
| API Provider | OpenAI Compatible |
| Error Message | Invalid tool call for 'search_files': missing nativeArgs |
| Frequency | 10+ times in a single session |
| Affected Tools | search_files, codebase_search, update_todo_list |
Reproduction Steps
- Open Zoo Code and perform tasks that require multiple tool calls
- As the session progresses, context length increases
- Model outputs XML tags instead of native JSON tool calls
- "missing nativeArgs" error occurs
Expected Result
Tool calls should be parsed and executed normally.
Actual Result
Three failure patterns were observed:
Pattern A: XML output as text (55%)
The model outputs XML tags directly in the response text instead of native JSON tool calls. Zoo Code's tool parser receives empty parameters, causing missing nativeArgs.
Pattern B: Incorrect nested JSON (27%)
The model tries to call the correct tool but structures parameters incorrectly. For example, nesting path and regex as a JSON string inside the file_pattern field.
Pattern C: Parallel tool call failure (18%)
When the model calls multiple tools in one turn, the first call succeeds but the second call's parameters are transmitted empty.
Additional Finding: Context Length vs Failure Rate
As the session progresses (context length increases), tool call failure rate increases dramatically:
| Session Phase | Tool Calls | Failure Rate |
|---|---|---|
| Early (1-5 calls) | 5 | 0% |
| Mid (6-15 calls) | 10 | 20% |
| Late (16+ calls) | 50+ | 60%+ |
This suggests that as the model's context window approaches saturation, its ability to format tool calls degrades.
Applied Patch (v3/v4/v5/v7)
We added an XML tool call detector/converter to extension.js:
- v3: Added converter that detects XML tool call tags and converts them to native JSON tool calls
- v4: Fixed v3 bug (empty object return in IIFE)
- v5: Added streaming buffer to accumulate partially received XML before converting
- v7: Enhanced truncated XML recovery (recovers from partially received function tags using parameter tags)
Patch Verification
| Check | Result |
|---|---|
| Node.js --check | PASSED |
| Existing patch markers preserved | ALL OK |
| 9 functional test cases | 9/9 PASS |
Recommended Official Fix
Add an XML tool call detector/converter in extension.js's tool parsing layer. When the model outputs XML tool call tags, convert them to native JSON tool calls before passing to the parser.
Activity
myk1yt commentedon Jun 25, 2026
[FINAL] Complete Patch Report with Exact Code Changes
File:
dist/extension.jsinzoocodeorganization.zoo-code-3.63.100188Platform: Windows 11, PowerShell 5.1 | Model: mimo-v2.5-pro (OpenAI Compatible)
Total patches applied: ~30 surgical modifications
Fix 1: Restrict XML Detection Regex
Where:
case "text"block. Search for__detect = new RegExpin extension.js.Why: Original regex was too broad. Patterns like
function=skillin system prompt tags triggered false positives.Before:
After:
Added
!e._xmlBufferguard and extended timeout 1000ms to 1500ms.Fix 2: Graceful Downgrade + Fallback Parser
Where:
case "tool_use",_xmlBuffersection. Search for_xmlBuffer!==void 0.Why: Failed XML parsing silently dropped tool calls.
_xmlParsedPendingflags never cleaned up.Before:
After:
Added
__parseRestfallback for partial XML recovery. Madesearch_filesregex parameter optional.Fix 3: Same-Line Backtick Tag Ignoring
Where:
__detectmatching loop (offset ~14870380).Why: Markdown inline code with XML patterns in rule files was detected as real tool calls.
Before:
After:
Fix 4: Text+XML Mixed Chunk Separation
Where:
case "text",if(__tool && __tool !== "text")(offset ~14870788).Why: Mixed text+XML chunks corrupted parser state, exposing closing tags as text.
Before:
After:
Fix 5: Committed Tool Skip
Where: Between
xmlBufferbreak and__detect(offset ~14869708).Why: Stale XML in buffer after tool commit caused re-detection and infinite loop.
Added:
Fix 6: attempt_completion Delegated Task Hang
Where:
FJt.execute()(offset ~14736177). Search forask("completion_result","",!1).Why: In delegated tasks, "Yes" button not shown.
ask()polls with timeout=Infinity.Before:
After:
Fix 7: Skill Loading Lock Release
Where:
n2()presentAssistantMessage,case "tool_use"(offset ~14755513).Why:
_xmlParsedPendingearly return leftpresentAssistantMessageLocked = true, blocking all subsequent calls.Before:
After:
Fix 8: Context-Aware Detection (Three-Layer Protection)
Where:
__detectmatching loop (offset ~14870380).Why: Backtick check only protected same-line inline code. Paragraphs, indented code, code fences unprotected.
Added on top of Fix 3:
Unit tests: 12/12 passing (previously 7/12).
Fix 9: Parameter Parser XML Truncation
Where:
__parseRestfunction (offset ~14861665).Why:
indexOffound FIRST closing tag inside parameter values. MCP tools were not registered in expected-parameter validation.Fix: Added 30+ MCP tool expected parameter sets to
__v37expected:When a fake parameter name appears inside a value, validation rejects it and the parser continues to find the real closing tag. 9/9 tests passing.
Verification
node --check extension.jssearch_filesexecutionattempt_completiondelegatedRecommended Official Fix
presentAssistantMessageask("completion_result")There are still some areas that could be improved, but I am satisfied with the current state and will continue using it as-is. If I feel the need for additional patches in the future, I will apply them and post an update.
Whether this is the appropriate solution should be confirmed by the Zoo Code bug fix team. Wishing for an ever-better Zoo Code.