You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Local Ollama subagents return tool calls as text instead of executing them in task/delegate #21181
Local Ollama subagents do not execute tool calls in task or delegate.
Instead of executing the tool and continuing the loop, OpenCode returns the tool call itself as text or pseudo-tool output. This causes false success and no real filesystem side effects.
I reproduced this with local subagents using Ollama models in WSL with the Ollama server running on Windows. Direct filesystem operations outside subagents work correctly, and direct calls to Ollama’s OpenAI-compatible API can return proper tool calls, so the issue appears to be in OpenCode’s local subagent runtime/tool execution path.
Custom global configuration with local SDD subagents and skill-registry workflow. No extra third-party runtime plugin beyond @opencode-ai/plugin.
Plugins
No response
OpenCode version
1.3.16
Steps to reproduce
Configure a local Ollama provider in OpenCode using @ai-sdk/openai-compatible.
Create or use a local subagent with file tools enabled (bash, read, edit, write) and permissions allowed.
Invoke the subagent through task or delegate and ask it to:
create a file with write, or
run pwd with bash
Observe that the subagent returns a tool call payload or pseudo-tool output as text instead of executing it.
Verify that the expected file does not exist and no real side effect happened.
Screenshot and/or share link
Operating System
WSL on Windows 11 (Ollama server running on Windows host)
This issue might be a duplicate of existing issues. Please check:
Ollama subagent executes tool calls correctly but always returns empty text to orchestrator #18423: Ollama subagent + tool calls issue — similar environment (Ollama subagent via task/delegate on Windows), though the reported symptom there is tools execute correctly but return empty text to the orchestrator, whereas here tools are not executing at all (returning as text). These may be the same underlying issue or closely related.
I can reproduce a very similar issue with OpenCode + local Ollama over the OpenAI-compatible endpoint.
Summary
OpenCode appears to claim that it wrote a file successfully, but the expected file is not created in the project directory. In my case, the model/tool flow looks successful in the chat, but there is no real filesystem side effect in the current working directory.
This is especially confusing because direct Ollama API tests return proper structured tool_calls, so the model and Ollama endpoint seem capable of tool calling. The issue seems to happen somewhere in the OpenCode runtime/tool execution path, or possibly around the working directory used for file tools.
Environment
Client machine: Windows 10
OpenCode running from PowerShell
Project directory: C:\Users\Light\Downloads\Test
Ollama server: remote Linux machine on LAN
Ollama endpoint used by OpenCode: http://192.168.1.92:11434/v1
Ollama server OS: TUXEDO OS / Ubuntu-Debian based Linux
GPU: NVIDIA GTX 1050 3 GB Max-Q
RAM: 16 GB
Provider config: @ai-sdk/openai-compatible
Models tested
Models that failed / produced fake or non-executed tool calls
qwen2.5-coder variants through Ollama
hhao/qwen2.5-coder-tools:3b
hhao/qwen2.5-coder-tools:1.5b
With these models, tool calls were often printed as JSON-like text instead of being executed.
Models that passed direct Ollama API tool-call tests
huihui_ai/qwen3-abliterated:4b, aliased as qwen3-ablit-4b-tools-8k
huihui_ai/qwen3-abliterated:1.7b, aliased as qwen3-ablit-1_7b-tools-4k
Direct API test against Ollama /v1/chat/completions returned proper structured tool calls:
So Ollama and the model can return real tool calls.
OpenCode behavior
Prompt used inside OpenCode:
Create a real file named index.html in the current directory using the write tool. Put a basic HTML page inside it with the title "Test". Do not print JSON. Do not print HTML. After writing the file, reply only: created index.html
OpenCode displayed something like:
# Wrote index.html
<!DOCTYPE html>
<html lang="en">
...
</html>
Then it produced a summary saying the file was successfully written:
Progress
Done
- Wrote file successfully.
Relevant Files
- index.html: Created with the basic HTML structure and title "Test".
But after exiting/checking PowerShell:
cd C:\Users\Light\Downloads\Test
Test-Path .\index.html
Result:
False
So the expected file was not created in the project directory.
A recursive search found an index.html under:
C:\Users\Light\.config\opencode\index.html
That suggests the file may be written in OpenCode’s config directory instead of the project working directory, or the tool execution context is not the same as the TUI/project directory.
Additional symptom
After the apparent write, OpenCode entered repeated thinking/compaction/build cycles, even though the task was supposedly done:
Compaction -> Build -> Compaction -> Build
It kept summarizing that the file was created, but the expected project file still did not exist.
Expected behavior
If OpenCode says it used the write tool to create index.html, the file should exist in the current project directory:
Direct Ollama API calls return proper structured tool_calls with the same model. The model is not merely printing JSON in that case. But inside OpenCode, the write operation either does not execute in the expected directory or reports false success.
This looks related to local Ollama/OpenAI-compatible tool execution, working-directory handling, or compaction/tool-result handling inside OpenCode.
Activity
github-actions commentedon Apr 6, 2026
This issue might be a duplicate of existing issues. Please check:
task/delegateon Windows), though the reported symptom there is tools execute correctly but return empty text to the orchestrator, whereas here tools are not executing at all (returning as text). These may be the same underlying issue or closely related.fix: fallback tool call parsing for Ollama/local model subagents (ano…
HIK-506 commentedon May 31, 2026
I can reproduce a very similar issue with OpenCode + local Ollama over the OpenAI-compatible endpoint.
Summary
OpenCode appears to claim that it wrote a file successfully, but the expected file is not created in the project directory. In my case, the model/tool flow looks successful in the chat, but there is no real filesystem side effect in the current working directory.
This is especially confusing because direct Ollama API tests return proper structured
tool_calls, so the model and Ollama endpoint seem capable of tool calling. The issue seems to happen somewhere in the OpenCode runtime/tool execution path, or possibly around the working directory used for file tools.Environment
C:\Users\Light\Downloads\Testhttp://192.168.1.92:11434/v1@ai-sdk/openai-compatibleModels tested
Models that failed / produced fake or non-executed tool calls
qwen2.5-codervariants through Ollamahhao/qwen2.5-coder-tools:3bhhao/qwen2.5-coder-tools:1.5bWith these models, tool calls were often printed as JSON-like text instead of being executed.
Models that passed direct Ollama API tool-call tests
huihui_ai/qwen3-abliterated:4b, aliased asqwen3-ablit-4b-tools-8khuihui_ai/qwen3-abliterated:1.7b, aliased asqwen3-ablit-1_7b-tools-4kDirect API test against Ollama
/v1/chat/completionsreturned proper structured tool calls:So Ollama and the model can return real tool calls.
OpenCode behavior
Prompt used inside OpenCode:
OpenCode displayed something like:
Then it produced a summary saying the file was successfully written:
But after exiting/checking PowerShell:
cd C:\Users\Light\Downloads\Test Test-Path .\index.htmlResult:
So the expected file was not created in the project directory.
A recursive search found an
index.htmlunder:That suggests the file may be written in OpenCode’s config directory instead of the project working directory, or the tool execution context is not the same as the TUI/project directory.
Additional symptom
After the apparent write, OpenCode entered repeated thinking/compaction/build cycles, even though the task was supposedly done:
It kept summarizing that the file was created, but the expected project file still did not exist.
Expected behavior
If OpenCode says it used the
writetool to createindex.html, the file should exist in the current project directory:Actual behavior
OpenCode claims success, but:
Test-Path C:\Users\Light\Downloads\Test\index.htmlreturns:
A file may instead appear under:
Why I think this is an OpenCode-side issue
Direct Ollama API calls return proper structured
tool_callswith the same model. The model is not merely printing JSON in that case. But inside OpenCode, the write operation either does not execute in the expected directory or reports false success.This looks related to local Ollama/OpenAI-compatible tool execution, working-directory handling, or compaction/tool-result handling inside OpenCode.
I can provide full logs/config if useful.
github-actions commentedon Jul 31, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.