Skip to content

Ollama subagent executes tool calls correctly but always returns empty text to orchestrator #18423

Closed as not planned

Description

@pablohevia

Description

When using an Ollama model as a subagent (via @agentname / task tool), the subagent executes tool calls correctly but its text response is always empty when returned to the orchestrator.

Tested with two different Ollama models — the issue is consistent across both.

Environment

  • opencode version: 1.2.27
  • OS: Windows 10
  • Orchestrator model: minimax-m2.5-free (cloud)
  • Hardware: Intel i7-6700T, NVIDIA RTX 3060 (12 GB VRAM), 32 GB RAM

Models tested

Model Size Context Plain text (no tools) Text after tool call
ollama/qwen3.5:9b 6.6 GB 32k ✅ works ❌ empty
ollama/qwen2.5-coder:7b 4.7 GB 32k ✅ works ❌ empty
nvidia/z-ai/glm4.7 cloud 204k ✅ works ✅ works (but slow, ~3-8min)

Behavior

Expected: subagent executes tools and returns a text summary to the orchestrator.

Actual: subagent executes tools correctly (files are written, bash commands run), but returns empty string to the orchestrator. The orchestrator receives no confirmation and must verify results manually.

Reproduction steps

  1. Configure a subagent in ~/.config/opencode/agents/coder.md with model: ollama/qwen3.5:9b or ollama/qwen2.5-coder:7b
  2. From a session using a cloud model as orchestrator, delegate: @coder create a file test.txt with content "hello"
  3. The file is created correctly on disk
  4. The orchestrator receives an empty return from the subagent

Key evidence

Plain text without tools works:

Task: "Say 'Hola, soy coder' without using any tools"
Result: "Hola, soy coder"  ← correct

Text after tools is always empty:

Task: "Run echo 'test' and tell me what it returned"
→ bash tool executes correctly (output: "test")
→ subagent return to orchestrator: ""  ← empty

The subagent session log (visible via ctrl+x) confirms the model DID generate a text response after the tool call ("El comando devolvió: test"). The text is lost between the subagent and the orchestrator.

Conclusion

The issue is NOT:

  • The model failing to execute tools (it does)
  • The model failing to generate text (it does, visible in subagent session log)
  • Hardware/VRAM limitations (RTX 3060 with 12 GB VRAM, models fit entirely in GPU)
  • Model-specific — reproduced consistently with both Qwen models tested

The issue appears to be that text generated by an Ollama model after tool calls is not captured or forwarded by opencode to the orchestrator.

Related issues

Plugins

No response

OpenCode version

OpenCode 1.2.27

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

Windows 10

Terminal

PowerShell 7

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 20, 2026
  2. schell commented on Mar 20, 2026

    @schell

    I'm seeing this as well and I'm on macOS 26.3.1.

  3. ParthSareen commented on Mar 20, 2026

    @ParthSareen

    Can you confirm this behavior with larger cloud models as well?

    How much context length are you running at? Could you run ollama ps or check context length in the setting page for Ollama?

  4. pablohevia commented on Mar 20, 2026

    @pablohevia
    Author

    Tested with two different cloud orchestrators (minimax-m2.5-free and Nemotron 3 Super via OpenCode Zen) — the behavior is identical with both.

    ollama ps output while subagent was active:

    NAME          ID              SIZE     PROCESSOR    CONTEXT    UNTIL
    qwen3.5:9b    6488c96fa5fa    10 GB    100% GPU     32768      4 minutes from now
    

    Note: coder.md has num_ctx: 16384 set, but Ollama is running at 32768 — the parameter doesn't seem to be passed through to Ollama.

  5. ParthSareen commented on Mar 20, 2026

    @ParthSareen

    @pablohevia 32k is still quite low for coding agents - especially for a 9b parameter model. Could you try one of the Ollama cloud models? I want to narrow down if it's just a small model issue or another issue on our end

    https://docs.ollama.com/integrations/opencode

  6. schell commented on Mar 21, 2026

    @schell
    ❯ ollama ps
    NAME              ID              SIZE     PROCESSOR    CONTEXT    UNTIL                   
    qwen3.5:latest    6488c96fa5fa    20 GB    100% GPU     262144     About a minute from now 
    
  7. ParthSareen commented on Mar 21, 2026

    @ParthSareen

    @schell I'll double check some of the qwen3/5 bits, but do you run into the same issue with a larger qwen3.5 variant? like the 27 or 35b?

  8. schell commented on Mar 21, 2026

    @schell

    I've never tried those and I'm not quite sure how to set them up.

  9. schell commented on Mar 21, 2026

    @schell

    I figured it out - it's pulling the 35b right now.

  10. schell commented on Mar 21, 2026

    @schell

    With glm-4.7-flash:latest everything works as expected. I'm still downloading a bigger qwen variant.

  11. schell commented on Mar 21, 2026

    @schell

    Just for more info, here's ollama ps while running glm-4.7-flash:

    ❯ ollama ps
    NAME                    ID              SIZE     PROCESSOR    CONTEXT    UNTIL              
    glm-4.7-flash:latest    d1a8a26252f1    40 GB    100% GPU     202752     4 minutes from now  
    
  12. pablohevia commented on Mar 21, 2026

    @pablohevia
    Author

    Tested with nvidia/z-ai/glm4.7 (204k context) as the subagent — same behavior. The subagent session log confirms the model generates text after the tool call, but the orchestrator receives empty.
    This rules out context size as the root cause. The issue appears to be in how opencode captures and forwards subagent output to the orchestrator, regardless of model or context length.

    Update: with nvidia/z-ai/glm4.7 (204k context), the subagent DID return text after the tool call — but after a ~8 minute delay.

  13. removed
    bugSomething isn't working
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  14. supernovae commented on May 4, 2026

    @supernovae

    I think this issue is related to #24090. In both cases the assistant message that comes back from a subagent loses fields during reconstruction. Here it drops the text field after a tool call, and in #24090 it drops the tool_calls field during history replay. The failure pattern is the same: everything works before the tool call, but the assistant message that should follow is partially empty once it passes through the subagent/orchestrator pipeline. That suggests a shared bug in the message reconstruction layer rather than model behavior.

  15. github-actions commented on Jul 5, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions