What happened?
When using Qwen Code with glm-5.2 through the OpenAI-compatible provider, thinking text is sometimes emitted as normal assistant output. The visible response includes internal reasoning followed by a stray </think> closing tag, for example:
The user is asking a simple logic puzzle. ... The answer is straightforward.</think>LEAK_CHECK_FINAL: 奖品在 B
This is easy to reproduce on Qwen Code 0.19.3 with the globally installed CLI.
Reproduction command:
qwen "请回答这个测试问题:三个盒子 A、B、C,只有一个有奖品。线索:A 是空的;B 有奖品;C 是空的。最终答案只输出一行:LEAK_CHECK_FINAL: 奖品在 B。" \
--auth-type openai \
--model glm-5.2 \
--approval-mode yolo \
--output-format stream-json
Observed structured output:
{
"type": "assistant",
"message": {
"content": [
{
"type": "text",
"text": "The user is asking a simple logic puzzle. Three boxes A, B, C, only one has a prize. Clues: A is empty, B has the prize, C is empty. The answer is straightforward.</think>LEAK_CHECK_FINAL: 奖品在 B"
}
]
}
}
API logging shows that the default request sends max_tokens: 131072. In that failing case, reasoning_content is empty and the reasoning text is returned in normal content.
The same prompt works correctly when the output token cap is lowered:
QWEN_CODE_MAX_OUTPUT_TOKENS=8000 qwen "请回答这个测试问题:三个盒子 A、B、C,只有一个有奖品。线索:A 是空的;B 有奖品;C 是空的。最终答案只输出一行:LEAK_CHECK_FINAL: 奖品在 B。" \
--auth-type openai \
--model glm-5.2 \
--approval-mode yolo \
--output-format stream-json
With QWEN_CODE_MAX_OUTPUT_TOKENS=8000, API logging shows max_tokens: 8000, the reasoning is returned separately, and the normal text output is only:
What did you expect to happen?
Thinking text should not be displayed as normal assistant output.
For models/endpoints that expose reasoning separately, Qwen Code should keep that content in the thinking channel and only show the final answer as normal text. If a provider returns a malformed stream or changes behavior at large max_tokens, Qwen Code should avoid the unsafe request shape or otherwise prevent the leaked reasoning from being displayed as final output.
Client information
Client Information
Qwen Code: 0.19.3
Runtime: Node.js v22.12.0 / npm 10.9.0
Platform: macOS Darwin 25.5.0 arm64
Auth type: openai
Model: glm-5.2
Login information
Using API key authentication with the OpenAI-compatible provider:
--auth-type openai
--model glm-5.2
- Endpoint: DashScope / ModelStudio OpenAI-compatible configuration
Anything else we need to know?
This appears to be max_tokens dependent:
max_tokens=131072: reproduces; thinking text is returned as normal content, ending with </think>.
max_tokens=8000: does not reproduce in the same test; thinking is separated and final text is clean.
This may be related to the recent change that made the default request use the model output limit, combined with the GLM-5 family output limit being detected as 128K. It is probably not a TUI rendering-only issue: the leak is visible in headless stream-json output and in the raw logged response shape.
中文
发生了什么?
使用 OpenAI-compatible provider 调用 glm-5.2 时,思考文本有时会被当作普通 assistant 输出展示。可见响应里会包含内部推理内容,并在最后出现一个游离的 </think> 结束标签,例如:
The user is asking a simple logic puzzle. ... The answer is straightforward.</think>LEAK_CHECK_FINAL: 奖品在 B
在全局安装的 Qwen Code 0.19.3 上很容易复现。
复现命令:
qwen "请回答这个测试问题:三个盒子 A、B、C,只有一个有奖品。线索:A 是空的;B 有奖品;C 是空的。最终答案只输出一行:LEAK_CHECK_FINAL: 奖品在 B。" \
--auth-type openai \
--model glm-5.2 \
--approval-mode yolo \
--output-format stream-json
观察到的结构化输出:
{
"type": "assistant",
"message": {
"content": [
{
"type": "text",
"text": "The user is asking a simple logic puzzle. Three boxes A, B, C, only one has a prize. Clues: A is empty, B has the prize, C is empty. The answer is straightforward.</think>LEAK_CHECK_FINAL: 奖品在 B"
}
]
}
}
API 日志显示默认请求发送了 max_tokens: 131072。在这个失败场景里,reasoning_content 为空,推理内容被返回在普通 content 里。
同一个 prompt 在降低输出 token cap 后表现正常:
QWEN_CODE_MAX_OUTPUT_TOKENS=8000 qwen "请回答这个测试问题:三个盒子 A、B、C,只有一个有奖品。线索:A 是空的;B 有奖品;C 是空的。最终答案只输出一行:LEAK_CHECK_FINAL: 奖品在 B。" \
--auth-type openai \
--model glm-5.2 \
--approval-mode yolo \
--output-format stream-json
设置 QWEN_CODE_MAX_OUTPUT_TOKENS=8000 后,API 日志显示 max_tokens: 8000,推理内容被单独返回,普通文本输出只有:
期望的结果是什么?
思考文本不应该作为普通 assistant 输出展示。
对于能单独返回 reasoning 的模型/endpoint,Qwen Code 应该把这些内容保留在 thinking 通道里,只把最终答案作为普通文本展示。如果某个 provider 在大 max_tokens 下返回异常格式,Qwen Code 应避免这种不安全的请求形态,或者至少防止泄漏的思考文本被展示为最终输出。
客户端信息
Client Information
Qwen Code: 0.19.3
Runtime: Node.js v22.12.0 / npm 10.9.0
Platform: macOS Darwin 25.5.0 arm64
Auth type: openai
Model: glm-5.2
登录信息
使用 OpenAI-compatible provider 的 API key 认证:
--auth-type openai
--model glm-5.2
- Endpoint: DashScope / ModelStudio OpenAI-compatible 配置
还有其他需要说明的吗?
这个问题看起来和 max_tokens 直接相关:
max_tokens=131072:可复现;思考文本返回在普通 content 中,并以 </think> 结尾。
max_tokens=8000:同一测试下不复现;思考内容被分离,最终文本干净。
这可能和最近默认请求改为使用模型输出上限、同时 GLM-5 系列输出上限被识别为 128K 有关。它应该不是单纯的 TUI 渲染问题:在 headless stream-json 输出和原始 API 日志形态中都能看到泄漏。
What happened?
When using Qwen Code with
glm-5.2through the OpenAI-compatible provider, thinking text is sometimes emitted as normal assistant output. The visible response includes internal reasoning followed by a stray</think>closing tag, for example:This is easy to reproduce on Qwen Code
0.19.3with the globally installed CLI.Reproduction command:
qwen "请回答这个测试问题:三个盒子 A、B、C,只有一个有奖品。线索:A 是空的;B 有奖品;C 是空的。最终答案只输出一行:LEAK_CHECK_FINAL: 奖品在 B。" \ --auth-type openai \ --model glm-5.2 \ --approval-mode yolo \ --output-format stream-jsonObserved structured output:
{ "type": "assistant", "message": { "content": [ { "type": "text", "text": "The user is asking a simple logic puzzle. Three boxes A, B, C, only one has a prize. Clues: A is empty, B has the prize, C is empty. The answer is straightforward.</think>LEAK_CHECK_FINAL: 奖品在 B" } ] } }API logging shows that the default request sends
max_tokens: 131072. In that failing case,reasoning_contentis empty and the reasoning text is returned in normalcontent.The same prompt works correctly when the output token cap is lowered:
QWEN_CODE_MAX_OUTPUT_TOKENS=8000 qwen "请回答这个测试问题:三个盒子 A、B、C,只有一个有奖品。线索:A 是空的;B 有奖品;C 是空的。最终答案只输出一行:LEAK_CHECK_FINAL: 奖品在 B。" \ --auth-type openai \ --model glm-5.2 \ --approval-mode yolo \ --output-format stream-jsonWith
QWEN_CODE_MAX_OUTPUT_TOKENS=8000, API logging showsmax_tokens: 8000, the reasoning is returned separately, and the normal text output is only:What did you expect to happen?
Thinking text should not be displayed as normal assistant output.
For models/endpoints that expose reasoning separately, Qwen Code should keep that content in the
thinkingchannel and only show the final answer as normal text. If a provider returns a malformed stream or changes behavior at largemax_tokens, Qwen Code should avoid the unsafe request shape or otherwise prevent the leaked reasoning from being displayed as final output.Client information
Client Information
Login information
Using API key authentication with the OpenAI-compatible provider:
--auth-type openai--model glm-5.2Anything else we need to know?
This appears to be
max_tokensdependent:max_tokens=131072: reproduces; thinking text is returned as normalcontent, ending with</think>.max_tokens=8000: does not reproduce in the same test; thinking is separated and final text is clean.This may be related to the recent change that made the default request use the model output limit, combined with the GLM-5 family output limit being detected as 128K. It is probably not a TUI rendering-only issue: the leak is visible in headless
stream-jsonoutput and in the raw logged response shape.中文
发生了什么?
使用 OpenAI-compatible provider 调用
glm-5.2时,思考文本有时会被当作普通 assistant 输出展示。可见响应里会包含内部推理内容,并在最后出现一个游离的</think>结束标签,例如:在全局安装的 Qwen Code
0.19.3上很容易复现。复现命令:
qwen "请回答这个测试问题:三个盒子 A、B、C,只有一个有奖品。线索:A 是空的;B 有奖品;C 是空的。最终答案只输出一行:LEAK_CHECK_FINAL: 奖品在 B。" \ --auth-type openai \ --model glm-5.2 \ --approval-mode yolo \ --output-format stream-json观察到的结构化输出:
{ "type": "assistant", "message": { "content": [ { "type": "text", "text": "The user is asking a simple logic puzzle. Three boxes A, B, C, only one has a prize. Clues: A is empty, B has the prize, C is empty. The answer is straightforward.</think>LEAK_CHECK_FINAL: 奖品在 B" } ] } }API 日志显示默认请求发送了
max_tokens: 131072。在这个失败场景里,reasoning_content为空,推理内容被返回在普通content里。同一个 prompt 在降低输出 token cap 后表现正常:
QWEN_CODE_MAX_OUTPUT_TOKENS=8000 qwen "请回答这个测试问题:三个盒子 A、B、C,只有一个有奖品。线索:A 是空的;B 有奖品;C 是空的。最终答案只输出一行:LEAK_CHECK_FINAL: 奖品在 B。" \ --auth-type openai \ --model glm-5.2 \ --approval-mode yolo \ --output-format stream-json设置
QWEN_CODE_MAX_OUTPUT_TOKENS=8000后,API 日志显示max_tokens: 8000,推理内容被单独返回,普通文本输出只有:期望的结果是什么?
思考文本不应该作为普通 assistant 输出展示。
对于能单独返回 reasoning 的模型/endpoint,Qwen Code 应该把这些内容保留在
thinking通道里,只把最终答案作为普通文本展示。如果某个 provider 在大max_tokens下返回异常格式,Qwen Code 应避免这种不安全的请求形态,或者至少防止泄漏的思考文本被展示为最终输出。客户端信息
Client Information
登录信息
使用 OpenAI-compatible provider 的 API key 认证:
--auth-type openai--model glm-5.2还有其他需要说明的吗?
这个问题看起来和
max_tokens直接相关:max_tokens=131072:可复现;思考文本返回在普通content中,并以</think>结尾。max_tokens=8000:同一测试下不复现;思考内容被分离,最终文本干净。这可能和最近默认请求改为使用模型输出上限、同时 GLM-5 系列输出上限被识别为 128K 有关。它应该不是单纯的 TUI 渲染问题:在 headless
stream-json输出和原始 API 日志形态中都能看到泄漏。