Skip to content

Studio: let --no-reasoning-preserve and a custom chat template turn off the Qwen3.8 preserve_thinking default - #15170

Merged
danielhanchen merged 5 commits into
unslothai:mainfrom
debojyoti-dev:fix/qwen38-preserve-thinking-override-15115
Oct 25, 2026
Merged

danielhanchen merged 5 commits into
unslothai:mainfrom
debojyoti-dev:fix/qwen38-preserve-thinking-override-15115

Conversation

@debojyoti-dev

@debojyoti-dev debojyoti-dev commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #15115

Before: on a Qwen3.8 GGUF, Studio always launched llama-server with --chat-template-kwargs {"preserve_thinking": true}. llama-server applies that kwarg after --[no-]reasoning-preserve, so passing --no-reasoning-preserve through llama_extra_args did nothing, and a user's chat_template_override written as preserve_thinking|default(false) was overruled. API clients that can't send chat_template_kwargs per request re-sent every past turn's reasoning.

After:

  • The launch preserve_thinking value follows an explicit --reasoning-preserve / --no-reasoning-preserve in the extra args (last flag wins, as in llama.cpp's parser), else an inherited LLAMA_ARG_REASONING_PRESERVE.
  • A chat_template_override gets the default its own text renders: Studio renders the override once in a sandboxed Jinja environment with preserve_thinking omitted and checks whether an earlier turn's reasoning survives. A copy of Qwen3.8's own template (preserve_thinking is undefined or ...) keeps the on default; a |default(false) template gets off; a template that does not render falls back to off.
  • The Qwen3.8 default with its own GGUF template is unchanged (Default preserve thinking on for Qwen3.8 #9096).
  • _preserve_thinking_default is updated too, so /load, /status, the Studio toggle and the /v1/messages replay path report the value the server actually runs with.

Testing:

  • TestThePreserveThinkingLaunchDefault in tests/test_launch_reasoning_flag.py drives the real load_model with a faked Popen: 13 cases, 9 fail on the merge base and all pass here. Reverting the render step to a plain off default fails the two "override that keeps reasoning stays on" cases.
  • Related suites (test_launch_reasoning_flag, test_gemma4_chat_template_override, test_external_preserve_thinking, test_anthropic_messages, test_safetensors_capability_advertise, test_llama_thinking_budget, test_managed_engine_reasoning, test_openai_auto_switch): 1738 passed; the 5 test_openai_auto_switch MCP cache failures are identical on the merge base.
  • test_launch_reasoning_flag.py on Linux, macOS (Apple Silicon) and Windows: 97 passed on each.
  • Live llama-server (b11869, CPU, tiny GGUF) /apply-template with a historical reasoning_content marker, using the reporter's template: the old launch argv keeps the marker even with --no-reasoning-preserve; the new argv drops it, and --reasoning-preserve brings it back. With Qwen3.8's own template as the override, the marker stays.

…ff the Qwen3.8 preserve_thinking launch default

llama-server applies --chat-template-kwargs after --[no-]reasoning-preserve, so the
preserve_thinking: true Studio pins for Qwen3.8 beat both the flag and a user's
chat_template_override. The launch kwarg now follows an explicit
--reasoning-preserve / --no-reasoning-preserve (or LLAMA_ARG_REASONING_PRESERVE),
and an override falls back to the off default every other family uses.

Fixes unslothai#15115
@danielhanchen danielhanchen self-assigned this Oct 25, 2026
…ts own template renders

Forcing the off default broke an override that keeps Qwen3.8's own
'preserve_thinking is undefined or ...' line: it lost history reasoning
it kept before. Render the override once with the kwarg omitted and use
what it does.

[skip ci]
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-25T12:39:11.797069Z
We couldn’t complete this review. Comment @codex review to try again.
b7b23b4 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

An unknown error occurred
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

An unknown error occurred
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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

Labels

None yet

Projects

None yet

2 participants