Repository navigation
Closed
Labels
bugSomething isn't workingSomething isn't workingcoreAnything pertaining to core functionality of the application (opencode server stuff)Anything pertaining to core functionality of the application (opencode server stuff)
Description
Description
When using OpenCode with Ollama or other local OpenAI-compatible endpoints, if the model response includes a field reasoning (as produced by Ollama), the result is an infinite spin on 'Build - ' and high CPU, with no output. OpenCode expects Copilot/OpenAI-specific fields: reasoning_text or reasoning_opaque only, and does not accept the generic reasoning field. As a result, UI never recovers. This is confirmed for Ollama 0.20.4 (gemma4, qwen3.5) on Arch Linux. See reproduction step 5 for actual Ollama response proof.
I've tested with a patched version of OpenCode and it works.
modified packages/opencode/src/provider/sdk/copilot/chat/openai-compatible-chat-language-model.ts
@@ -757,6 +757,7 @@ const OpenAICompatibleChatResponseSchema = z.object({
// Copilot-specific reasoning fields
reasoning_text: z.string().nullish(),
reasoning_opaque: z.string().nullish(),
+ reasoning: z.string().nullish(), // Ollama-compatibility
tool_calls: z
.array(
z.object({
@@ -792,6 +793,7 @@ const createOpenAICompatibleChatChunkSchema = <ERROR_SCHEMA extends z.core.$ZodT
// Copilot-specific reasoning fields
reasoning_text: z.string().nullish(),
reasoning_opaque: z.string().nullish(),
+ reasoning: z.string().nullish(), // Ollama-compatibility
tool_calls: z
.array(
z.object({
Plugins
No response
OpenCode version
1.4.3
Steps to reproduce
- Launch Ollama (0.20.4 or later) with a compatible chat model (e.g., gemma4, qwen3.5)
- Configure OpenCode to use your local OpenAI-compatible backend:
ollama launch opencode - Prompt the model (any message)
- Observe: UI spins/hangs with high CPU, never returns output
- Inspect Ollama's response JSON, which looks like:
{
"id": "chatcmpl-123",
"object": "chat.completion",
"choices": [{
"message": {
"role": "assistant",
"content": "...",
"reasoning": "Some chain-of-thought reasoning steps"
}
}]
}
- Confirm OpenCode only parses
reasoning_text/reasoning_opaque(seeopenai-compatible-chat-language-model.ts), notreasoning. - Workaround: Patch the Zod schema in OpenCode to accept
reasoning: z.string().nullish().
Screenshot and/or share link
No response
Operating System
Linux (Arch)
Terminal
Kitty
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingcoreAnything pertaining to core functionality of the application (opencode server stuff)Anything pertaining to core functionality of the application (opencode server stuff)
Activity
budu commentedon Apr 10, 2026
It looks like I was totally wrong and OpenCode works without the fix after all.
OpenCode spinning endlessly seems to be related to running in a specific directory, I'm looking for an explanation.
budu commentedon Apr 10, 2026
This actually appears to be a much worse issue related to #6845
I was running OpenCode from big directory and it was trying to scan everything.
So OpenCode actually end up responding to my prompt after 5+ minutes. The worse being that it then start using 100% CPU for quite some time.
I then noticed high disk space usage:
I think enabling snapshot by default without some kind of limit nor any UI notice is extremely bad design.