Skip to content

fix(agents): drive Qwen thinking via chat_template_kwargs on OpenAI-c… - #7832

Open
knowhao wants to merge 1 commit into
block:mainfrom
knowhao:fix/llm-openai-compat-thinking-kwargs
Open

knowhao wants to merge 1 commit into
block:mainfrom
knowhao:fix/llm-openai-compat-thinking-kwargs

Conversation

@knowhao

@knowhao knowhao commented Sep 23, 2026

Copy link
Copy Markdown

Summary

The OpenAI-compat agent path set reasoning control only through the OpenAI reasoning_effort body field. llama.cpp's HTTP server honours that field, but vLLM's OpenAI-compat endpoint ignores it and reads thinking control exclusively from the Qwen3 chat-template variable chat_template_kwargs.enable_thinking. Agents pointed at a vLLM-served Qwen3 therefore couldn't be switched off: BUZZ_AGENT_THINKING_EFFORT=none sent reasoning_effort:"none", the server dropped it, and the model ran at its default (thinking on) regardless.

This makes openai_body also emit chat_template_kwargs.enable_thinking — false for none/minimal, true for any on-level — alongside the existing reasoning_effort. Each backend reads only the field it understands, so sending both keeps the on/off intent correct across llama.cpp and vLLM, and is a no-op where a field is ignored. When no effort is set, neither field is emitted and the provider's default is preserved.

Related issue

Fixes #7831

Testing

No UI changes (backend request-body change). Verified two ways:

Unit tests in buzz-agent: 545 pass, including new tests asserting enable_thinking=false for none/minimal, enable_thinking=true for every on-level, and that no chat_template_kwargs is emitted when effort is unset. just fmt-check and just clippy pass; DCO signed.
Live end-to-end against real servers: a vLLM 0.27 Qwen3 build — with the fix, none drops completion tokens 73→5 (thinking off) and on-levels restore it; a llama.cpp server — none stays off and medium/high still vary depth as before, confirming the added field is a no-op there.

…ompat

buzz-agent's openai-compat path sets reasoning control only through the
OpenAI `reasoning_effort` body field. That field is honoured by llama.cpp's
HTTP server (which maps it onto Qwen3's /think switch) but is *ignored* by
vLLM's OpenAI-compat endpoint, which reads thinking control exclusively from
the Qwen3 chat-template variable `chat_template_kwargs.enable_thinking`.

As a result, agents pointed at a vLLM-served Qwen3 could not be switched
off: BUZZ_AGENT_THINKING_EFFORT=none sent reasoning_effort="none", the server
dropped it, and the model ran at its default (thinking on) regardless.

Also emit chat_template_kwargs.enable_thinking (false for none/minimal, true
for any on-level) alongside reasoning_effort. Each backend reads only the
field it understands, so sending both keeps the on/off intent correct across
backends and is a no-op where a field is ignored. When no effort is set,
neither field is emitted and the provider's default is preserved.

Signed-off-by: knowhao <hao.a.le@gmail.com>
@knowhao
knowhao requested a review from a team as a code owner September 23, 2026 05:09
@github-actions

Copy link
Copy Markdown

🔐 Codex Security Review

Status: review required for the current range.

The current range is ec7ea38f62ea917f15e85a678bc94f3bbee5bb64...b9fa1a08aa536d343c813d4b7ffa368ff6392584.
A new review must complete for this exact range. When manual authorization
is required, a Block organization member must comment exactly
@buzz-security-review b9fa1a08aa536d343c813d4b7ffa368ff6392584 to authorize a new review.
Any previous review applies only to its recorded range.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

buzz-agent ignores reasoning_effort on vLLM OpenAI-compat endpoints — thinking can't be turned off

1 participant