[PR #15022] [MERGED] model/parsers: Close think block if tool block starts in Qwen3.5 #14973

Closed
opened 2026-04-13 01:07:20 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/15022
Author: @amatas
Created: 3/23/2026
Status: Merged
Merged: 3/27/2026
Merged by: @ParthSareen

Base: mainHead: parse_tool_open_thinking


📝 Commits (1)

  • 88d028f model/parsers: close think block if tool block starts in Qwen3.5

📊 Changes

2 files changed (+23 additions, -8 deletions)

View changed files

📝 model/parsers/qwen35.go (+9 -0)
📝 model/parsers/qwen35_test.go (+14 -8)

📄 Description

This change fixes https://github.com/ollama/ollama/issues/14745 when the model starts a tool_call block without closing the think block:

Thinking: I need to mock Valkey for tests. Let me check how the app initializes Valkey and update TESTING.md with this information.
<tool_call>
<function=bash>
<parameter=command>
grep "redacted" | head -20
</parameter>
<parameter=description>
Find Valkey initialization
</parameter>
</function>
</tool_call>

I saw this behavior while using Opencode + Ollama 0.18.2 + qwen3.5:9b. I have been working for a couple of days with the same setup and this patch without problems.

Issues that can be fixed with this PR as well:

external:

Regards, and thank you all for this great tool.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/15022 **Author:** [@amatas](https://github.com/amatas) **Created:** 3/23/2026 **Status:** ✅ Merged **Merged:** 3/27/2026 **Merged by:** [@ParthSareen](https://github.com/ParthSareen) **Base:** `main` ← **Head:** `parse_tool_open_thinking` --- ### 📝 Commits (1) - [`88d028f`](https://github.com/ollama/ollama/commit/88d028ff9b1e2d9e64c208542a1cc39fb5730bde) model/parsers: close think block if tool block starts in Qwen3.5 ### 📊 Changes **2 files changed** (+23 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `model/parsers/qwen35.go` (+9 -0) 📝 `model/parsers/qwen35_test.go` (+14 -8) </details> ### 📄 Description This change fixes https://github.com/ollama/ollama/issues/14745 when the model starts a `tool_call` block without closing the `think` block: ``` Thinking: I need to mock Valkey for tests. Let me check how the app initializes Valkey and update TESTING.md with this information. <tool_call> <function=bash> <parameter=command> grep "redacted" | head -20 </parameter> <parameter=description> Find Valkey initialization </parameter> </function> </tool_call> ``` I saw this behavior while using Opencode + Ollama 0.18.2 + qwen3.5:9b. I have been working for a couple of days with the same setup and this patch without problems. Issues that can be fixed with this PR as well: - https://github.com/ollama/ollama/issues/14745 - https://github.com/ollama/ollama/issues/14601 - Partial https://github.com/ollama/ollama/issues/14493 - https://github.com/ollama/ollama/issues/14492 external: - https://github.com/openclaw/openclaw/issues/45000 Regards, and thank you all for this great tool. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-13 01:07:20 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#14973