Commit 0bec16e38 for llama.cpp
commit 0bec16e3880a148a7fc3887cdf71f81c547aff7a
Author: Aldehir Rojas <hello@alde.dev>
Date: Wed Sep 16 01:47:28 2026 -0500
chat : force `\n</think>` on reasoning budget end for qwen3-coder (#28869)
diff --git a/common/parsers/qwen3-coder.cpp b/common/parsers/qwen3-coder.cpp
index 7938a2027..208f551f1 100644
--- a/common/parsers/qwen3-coder.cpp
+++ b/common/parsers/qwen3-coder.cpp
@@ -23,8 +23,9 @@ common_chat_params common_chat_params_init_qwen3_coder(const common_chat_templat
if (supports_reasoning) {
data.thinking_start_tag = "<think>";
// Support both </think> and <tool_call> as reasoning end sequences.
+ // The newline variant comes first so it is included in the forced message
// <function= is omitted, as it is a workaround for Qwen3-Coder which is not a thinking model
- data.thinking_end_tags = { "</think>", "<tool_call>" };
+ data.thinking_end_tags = { "\n</think>", "</think>", "<tool_call>" };
data.preserved_tokens.insert(data.preserved_tokens.end(), { "<think>", "</think>" });
}