Skip to content

Qwen3.6 tool calls loop with empty arguments: qwen-chat-template missing preserve_thinking #3325

Description

@0xbentang

What happened?

Qwen3.6 loops emitting tool calls with empty {} arguments on multi-turn conversations via LM Studio + thinkingFormat: "qwen-chat-template". After 2–3 turns the model reasons correctly ("I need to pass title") but every call arrives with empty args.

Cause: Qwen3.6's chat template drops prior-turn <think> blocks unless preserve_thinking=true is passed in chat_template_kwargs. pi only sets enable_thinking at packages/ai/src/providers/openai-completions.ts:424. Background: https://www.reddit.com/r/LocalLLaMA/comments/1sne4gh/psa_qwen36_ships_with_preserve_thinking_make_sure

This makes local Qwen3.6 GGUF unusable for agent loops via qwen-chat-template.

Steps to reproduce

  1. Load unsloth/Qwen3.6-35B-A3B-GGUF in LM Studio.
  2. Register it in models.json with "thinkingFormat": "qwen-chat-template" and "reasoning": true.
  3. Run any task that calls the same tool across ≥3 turns. After turn 2 every tool call has arguments: {}.

Expected behavior

Prior thinking preserved across turns. One-line fix:

(params as any).chat_template_kwargs = {
    enable_thinking: !!options?.reasoningEffort,
    preserve_thinking: true,
};

Version

0.67.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions