Repository navigation
Description
MiMo V2.5 outputs tml:function_calls as plain text instead of structured tool calls
Description
When using MiMo V2.5 (via opencode-go/mimo-v2.5), the model occasionally outputs XML-like function call syntax as plain text instead of using the structured OpenAI tool_calls API format. The malformed output looks like:
<tml:function_calls>
<invoke name="bash">
<parameter name="command">some-command</parameter>
</invoke>
</tml:function_calls>
Since this arrives as text-delta event (not a structured tool_call event), the processor treats it as the final response text, the step finishes with reason stop (not tool-calls), and the agent loop terminates, halting execution mid-task.
Steps to Reproduce
- Select
opencode-go/mimo-v2.5as the model - Send a prompt that triggers tool use (e.g., run a command, edit a file)
- Observe that the agent outputs
tml:function_callsas rendered text and stops executing
Expected Behavior
The model tool call output should be parsed and dispatched as structured tool calls, allowing execution to continue.
Root Cause Analysis
The opencode runtime exclusively handles OpenAI-style structured tool_calls (SSE delta.tool_calls[].function.{name,arguments}). There is no text-based fallback parser for models that output XML-like function call syntax as plain text.
When MiMo outputs tml:function_calls as text:
text-deltaevents accumulate the XML content- No
tool-callevents are ever emitted by the provider/SDK - On
step-finish, the finish reason isstop(nottool-calls) - The agent loop decides to stop, ending execution
Key code paths involved:
- packages/llm/src/protocols/utils/tool-stream.ts - only parses structured SSE
tool_calls - packages/opencode/src/session/processor.ts - only handles
tool-call/tool-resultevents - packages/opencode/src/session/llm/ai-sdk.ts -
toLLMEvents()only forwards structured tool calls
Suggested Fix
Add text-based XML function call detection as a fallback in the processor or LLM event pipeline. When the step finishes with reason stop but the accumulated text contains XML-like function call patterns (<function_calls>, <invoke name=...>, etc.), parse the text and emit synthetic tool-call events to allow execution to continue.
Possible implementation locations:
- packages/opencode/src/session/processor.ts - in the
text-endorstep-finishhandler - packages/opencode/src/session/llm/ai-sdk.ts - in
toLLMEvents(), intercept text events
Environment
- opencode version: 1.18.18 (npm)
- Model:
opencode-go/mimo-v2.5 - OS: Windows 11
- Terminal: PowerShell
Additional Context
This may be related to #43185 (mimo-v2.5 tool calls fail with invalid tool calls) and #42923 (mimo-v2.5 stuck in infinite thinking loop), as all three stem from MiMo tool call format being incompatible with opencode expectations. The tml: prefix in tml:function_calls appears to be a model-specific XML namespace or tokenizer artifact.
Activity
thdxr commentedon Oct 11, 2026
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (
opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊