← Back to PRs

#9451: feat(qwen): enable DashScope/Qwen enable_thinking for /think

by sm-yjr open 2026-02-05 07:14 View on GitHub →
agents stale
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