Skip to content

OpenClaw discards Ollama reasoning field — model output silently lost #247

Description

@kakuteki

Description

When OpenClaw sends a chat completion request to an Ollama reasoning model (e.g. nemotron-3-nano:30b), the model returns its output in the reasoning field of the response, not in content. OpenClaw only reads content, so the actual model output is silently thrown away.

This is the root cause behind #246 (blank agent responses with Ollama).

The problem

Ollama's OpenAI-compatible API returns reasoning model output like this:

{
  "choices": [{
    "message": {
      "role": "assistant",
      "content": "",
      "reasoning": "Hello! I'm happy to help. What would you like to know?"
    }
  }]
}

The model did produce a response. It's sitting right there in reasoning. But OpenClaw reads content, gets an empty string, and renders a blank bubble in the dashboard.

This affects every reasoning model served through Ollama — not just Nemotron Nano. Qwen3, DeepSeek-R1, and any future reasoning model will hit the same issue.

What should happen

Two things need to happen (ideally both):

1. NemoClaw should tell Ollama to skip reasoning when it's not needed

Ollama respects reasoning_effort: "none" (or think: false in the native API). When this is set, the model writes directly into content and the response works as expected:

{
  "choices": [{
    "message": {
      "role": "assistant",
      "content": "Hello! I'm happy to help. What would you like to know?"
    }
  }]
}

The Ollama provider configuration in NemoClaw should send this parameter by default for agent chat, since the reasoning chain is not surfaced to the user anyway.

2. OpenClaw should not silently discard non-empty reasoning when content is empty

Even if the provider misconfigures the model, a non-empty reasoning field with an empty content field is a clear signal that the output ended up in the wrong place. OpenClaw should fall back to reasoning as display text rather than showing nothing.

Affected components

  • NemoClaw: Ollama provider setup (openshell provider create) — does not pass reasoning-related parameters
  • OpenClaw: Chat completion response parsing — ignores reasoning field entirely

Related

Activity

  1. jefffroman commented on Apr 3, 2026

    @jefffroman

    Additional data point: Gemma 4 31B on Ollama 0.20.0 — the thinking field doesn't just suppress content, it also suppresses tool_calls.

    When the model thinks before making a tool call, the Ollama API response contains thinking text but tool_calls: null. Simple prompts that don't trigger thinking produce tool calls correctly. This means reasoning: false / OLLAMA_REASONING_EFFORT=none is required not just for visible content but for tool calling to work at all with thinking-capable models.

    Tested with direct curl against Ollama's /api/chat endpoint — this is an Ollama-level issue, not OpenClaw parsing. With think: false set explicitly, complex prompts return all-null fields (content, thinking, tool_calls) — matching Ollama issue ollama/ollama#15260.

    Environment: Ollama 0.20.0, Gemma 4 31B (Q4_K_M), macOS, M3 Ultra.

  2. wscurran commented on Apr 22, 2026

    @wscurran
    Contributor

    Thanks for the additional data point — the thinking field suppressing tool_calls on Gemma 4 is a distinct case from the original reasoning/content swap, and worth tracking separately. This is still open and the tool_calls suppression makes it more impactful than originally scoped. We'll keep this on the radar as Ollama reasoning model support matures.

  3. added
    provider: ollama
    on May 19, 2026
  4. added
    area: inference
    area: local-models
    area: providers
    enhancement
    and removed on Jun 3, 2026
  5. removed
    enhancement
    on Jun 8, 2026
  6. latenighthackathon commented on Jun 24, 2026

    @latenighthackathon
    Collaborator

    Hi @kakuteki, thanks for the report. This one has been open a while: 67 releases have shipped since it was filed (we are now on v0.0.67), with onboarding, the sandbox runtime, config generation, and many platform paths reworked along the way. Could you check whether this is still happening for you on the latest version? Cheers!

  7. added
    VDR
    needs: cleanup-review
    on Jun 24, 2026
  8. houleixx commented on Jun 25, 2026

    @houleixx

    A request/response capture would probably make this easier to verify.

    ccglass can sit in front of an OpenAI-compatible local provider and show the raw response body, including fields like content, reasoning, tool calls,
    latency, and token usage.

    Project: https://github.com/jianshuo/ccglass

    For this issue, it could help produce a small repro showing that Ollama returns non-empty reasoning while content is empty, and that the client/parser
    discards it before rendering.

  9. sandl99 commented on Jun 25, 2026

    @sandl99
    Collaborator

    Verified on current setup against the latest target tag, v0.0.67.

    Checked the original #247 failure mode with nemotron-3-nano:30b through both paths:

    • Host Ollama /v1/chat/completions for Say hello returned non-empty choices[0].message.content along with reasoning.
    • Sandbox https://inference.local/v1/chat/completions returned non-empty choices[0].message.content.
    • The OpenClaw UI rendered the reply correctly.

    The original repro required content: "" with useful text only in reasoning, causing a blank dashboard bubble. That no longer reproduces here, so I am closing this as fixed/not reproducible on current versions.

    If this still reproduces elsewhere, please reopen with nemoclaw --version, openshell --version, ollama --version, the model source or Modelfile for nemotron-3-nano:30b, and raw host plus inference.local responses showing content and reasoning.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    VDRarea: inferencearea: local-modelsarea: providersneeds: cleanup-reviewprovider: ollama

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions