Summary
OpenAI-compatible chat models can return tool_calls[].function.arguments as XML-like payloads (e.g. <tool_call><function=...><parameter=...>). Continue currently assumes JSON-only arguments in multiple paths, which causes tool-call parsing/execution failures in Agent mode (seen as malformed fragmented tool calls and downstream index/list errors).
Reproduction
- Configure Continue model with OpenAI-compatible endpoint using a model that emits XML-like args (example: local Qwen OpenAI-compatible endpoint).
- Send a tool-heavy request (e.g., deep-dive / repository exploration).
- Observe returned tool call shape from model:
tool_calls[].function.name = "ls"
tool_calls[].function.arguments = "<tool_call>...<parameter=dirPath>src</parameter>..."
- Agent flow fails to parse/execute correctly because JSON parse returns
{}.
Direct API sample observed
function.arguments returned by model:
<tool_call>
<function=ls>
<parameter=dirPath>
src
</parameter>
<parameter=recursive>
True
</parameter>
</function>
</tool_call>
Root cause
Argument parsing assumes JSON-only payloads in shared and streaming paths. When XML-like payloads are returned, parsed args become empty and required-arg validation fails.
Proposed fix
Normalize XML-like argument payloads into structured args in shared parser and use that in both GUI and CLI streaming paths.
Files changed locally
core/tools/parseArgs.ts
core/tools/parseArgs.vitest.ts
gui/src/util/toolCallState.ts
gui/src/util/toolCallState.test.ts
extensions/cli/src/stream/streamChatResponse.helpers.ts
extensions/cli/src/stream/streamChatResponse.test.ts
Behavior after fix
- Keep existing JSON parse path unchanged.
- If JSON parse fails, parse
<parameter=name>value</parameter> entries.
- Scalar coercion supported:
true/false -> boolean
- numeric strings -> number
- JSON-looking scalar/array/object values -> parsed when valid
- otherwise string
Validation added
Regression tests added for XML-style tool argument parsing in core, GUI tool-call state assembly, and CLI stream processing.
Local commit refs (not yet pushed)
- main-based branch:
fix/Tool_Parsing-main, commit c89c2d170
- release-based branch:
fix/Tool_Parsing, commit 5840ed876
(Unable to push from this environment due 403 on continuedev/continue.git; creating issue with full details so maintainers can apply/cherry-pick.)
Summary
OpenAI-compatible chat models can return
tool_calls[].function.argumentsas XML-like payloads (e.g.<tool_call><function=...><parameter=...>). Continue currently assumes JSON-only arguments in multiple paths, which causes tool-call parsing/execution failures in Agent mode (seen as malformed fragmented tool calls and downstream index/list errors).Reproduction
tool_calls[].function.name = "ls"tool_calls[].function.arguments = "<tool_call>...<parameter=dirPath>src</parameter>..."{}.Direct API sample observed
function.argumentsreturned by model:Root cause
Argument parsing assumes JSON-only payloads in shared and streaming paths. When XML-like payloads are returned, parsed args become empty and required-arg validation fails.
Proposed fix
Normalize XML-like argument payloads into structured args in shared parser and use that in both GUI and CLI streaming paths.
Files changed locally
core/tools/parseArgs.tscore/tools/parseArgs.vitest.tsgui/src/util/toolCallState.tsgui/src/util/toolCallState.test.tsextensions/cli/src/stream/streamChatResponse.helpers.tsextensions/cli/src/stream/streamChatResponse.test.tsBehavior after fix
<parameter=name>value</parameter>entries.true/false-> booleanValidation added
Regression tests added for XML-style tool argument parsing in core, GUI tool-call state assembly, and CLI stream processing.
Local commit refs (not yet pushed)
fix/Tool_Parsing-main, commitc89c2d170fix/Tool_Parsing, commit5840ed876(Unable to push from this environment due
403oncontinuedev/continue.git; creating issue with full details so maintainers can apply/cherry-pick.)