#9451: feat(qwen): enable DashScope/Qwen enable_thinking for /think
agents
stale
Cluster:
DashScope/Qwen Role Management
Qwen (DashScope OpenAI-compatible) requires `enable_thinking=true` to return thinking content (in `reasoning_content`).
This PR makes OpenClaw work out of the box with `/think on` for DashScope/Qwen by relying on the upstream pi-ai compat layer.
Changes
- Bump `@mariozechner/pi-*` deps to `0.51.6` (adds OpenAI-compat `thinkingFormat: "qwen"` and parses `reasoning_content` → thinking blocks).
- Extend OpenClaw model compat config + schema with `thinkingFormat`.
- Auto-set `compat.thinkingFormat = "qwen"` for DashScope/Qwen Portal OpenAI-compatible baseUrls/providers (without overriding explicit user config).
- Tests covering the compat normalization.
Result
- When a reasoning-capable Qwen model is used and thinking is enabled, requests include `enable_thinking=true` and streamed reasoning shows up as thinking blocks.
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR updates the `@mariozechner/pi-*` dependencies to `0.51.6` and extends the model compat configuration/schema with a new `compat.thinkingFormat` field ("openai" | "zai" | "qwen"). It then updates `normalizeModelCompat` to auto-set `thinkingFormat: "qwen"` for DashScope/Qwen Portal OpenAI-compatible endpoints so that `/think on` triggers Qwen’s `enable_thinking=true` behavior via the upstream pi-ai compat layer. Unit tests were added to verify the normalization behavior and that explicit user config is not overridden.
<h3>Confidence Score: 4/5</h3>
- Mostly safe to merge once the lockfile install issue is addressed.
- Core code changes are small and covered by targeted unit tests, but the pnpm lockfile change to an SSH-authenticated git dependency will break installs in common CI/user environments unless corrected.
- pnpm-lock.yaml
<!-- greptile_other_comments_section -->
<sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub>
**Context used:**
- Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8))
- Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13))
<!-- /greptile_comment -->
Most Similar PRs
#23711: fix: disable developer role for DashScope/Qwen models (#23575)
by echoVic · 2026-02-22
79.3%
#11297: fix: add thinkingFormat 'qwen' compat for bailian/dashscope providers
by AdJIa · 2026-02-07
78.8%
#22741: fix(models): add DashScope/Qwen to normalizeModelCompat developer r...
by lailoo · 2026-02-21
75.7%
#14013: feat: Add Qwen DashScope API Key authentication support
by pkycy · 2026-02-11
73.1%
#22797: Feat/auto thinking mode
by jrthib · 2026-02-21
73.0%
#10097: fix: add empty thinking blocks to tool call messages when thinking is…
by cyxer000 · 2026-02-06
72.9%
#9739: #9291 fix(models): preserve existing models in models.json when mer...
by ximzzzzz · 2026-02-05
72.4%
#7316: fix: /chat dashboard performance
by felipcsousa · 2026-02-02
72.1%
#6559: Fix LiteLLM reasoning-tag handling + fallback to <think> content
by Najia-afk · 2026-02-01
72.1%
#5992: Fix: /status shows correct think level when used with /think (fixes...
by simran122 · 2026-02-01
71.9%