Skip to content

[BUG] <thought> tag is displayed as plain text instead of hidden reasoning in OpenAI Compatible provider for Gemma4 #323

@sagidM

Description

@sagidM

Gemma 4 (26B/31B) models stream reasoning inside <thought>...</thought> tags. Zoo Code currently only parses <think>, so the reasoning is treated as plain text. This causes:

  • reasoning leaks into the chat
  • the agent doesn't see a tool call on the first turn, triggering an unnecessary retry

To Reproduce
Steps to reproduce the behavior:

  1. Add an OpenAI-Compatible provider pointing to a Gemma 4 model.

  2. Base URL set to https://generativelanguage.googleapis.com/v1beta/openai

  3. Set API Key obtained from https://aistudio.google.com/api-keys

  4. Choose a reasoning Gemma4 model. There are only 2 options: models/gemma-4-26b-a4b-it and models/gemma-4-31b-it. Optionally, you can set Context Window Size to 256000 below.
    ImageExpected behavior

  5. Save. Make sure it is selected down below.

  6. Send any simple prompt (e.g., "2+2? Give only the answer")

  7. Observe raw ... in output

Image

Version: 3.55.0 (d63e7bd)

The tags <thought></thought> wrapped around the reasoning are not expected to show up. Moreover, the whole reasoning should be wrapped into the expandable Thinking item.

What is expected? I already implemented this fix and I creating this feature only because I have to reference the issue.
Here is what is expected

Image

Version: 3.55.0 (6966807)

Additional context

A similar issue alongside with a PR have already been presented for Roo Code:
RooCodeInc/Roo-Code#7615
RooCodeInc/Roo-Code#7617

It was closed. But note that other extensions like Kilo Code somehow solve that issue.
Also, it is not clear why Gemma4 and some other models in Zoo Code so often mention the tools like attempt_completion in the screenshots. I haven't experienced that for other models providing the same API Keys.
And sometimes they trigger additional API Request, even having the correct answer already, which I also did not see in other extensions

Image (in this screenshot, openrouter free model was configured, but it happens with other model, it's just an example)

In the history, I see a message from a user like: [ERROR] You did not use a tool in your previous response! Please retry with a tool use.. And the rest info. However, it would be absolutely fine to just throw the result to the output and let a user decide what do to next or at least give a user a button like: Model did not use a tool. If you don't satisfied with the result, click below. And a button like "Proceed with a tool".

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions