What happened?
📋 Overview
PR #3315 fixes Issue #3304: switching from a "thinking" model to a strict provider caused 422 API errors due to leaked reasoning_content fields. The fix works—it strips the field on every model switch, ensuring cross‑provider compatibility.
Why this is an issue: thinking stripping is unconditional. Even when switching between two thinking‑capable models, reasoning context is removed unnecessarily, reducing output quality on complex tasks.
📊 Qwen-Code Behavior Before and After the Fix
| Scenario |
Before PR #3315 |
After PR #3315 |
Thinking History |
| Thinking → Strict provider |
❌ 422 |
✅ Works (Bug fixed) |
❌ Deleted – stripThoughtsFromHistory() called |
| Thinking → Thinking provider |
✅ Preserved |
❌ Lost (Bug introduced) |
❌ Deleted – stripThoughtsFromHistory() called |
| Same model (no switch) |
✅ Preserved |
✅ Preserved |
✅ Kept – function not called |
⚠️ Note on permanent deletion: When stripThoughtsFromHistory() is invoked during a model switch, the reasoning_content field is irreversibly removed from the chat session history. It cannot be recovered later in the conversation, even if the user switches back to a thinking‑capable model.
⚠️ Impact on Qwen-Code
Qwen-Code is built for DashScope and Qwen's thinking‑first model direction. Under the current fix, every switch permanently deletes reasoning history—hurting Qwen models and any thinking model like Gemini. The application discards the very context it was designed to leverage, working against its own future.
👤 Impact on Users
Switching between two thinking‑capable models (e.g., qwen3.6-plus → Gemini 1.5 Pro) now strips reasoning_content mid‑conversation. The second model receives less context than it can handle, breaking multi‑step reasoning continuity and degrading output on complex tasks.
What did you expect to happen?
✅ Expected Outcome
All scenarios should ideally be ✅:
- No API failures when switching providers
- No loss of reasoning context when the next model supports it
- Thoughts remain in session history in all scenarios (not permanently deleted on switch)
Currently, the fix ensures safety but not full capability. The merge permanently deletes thinking history from the chat session on any model switch, even when preservation would be both valid and beneficial.
🎯 Desired Behavior (With Provider-Aware Stripping)
| Scenario |
Desired Behavior |
Thinking History |
Reasoning Content |
| Thinking → Strict provider |
✅ Works |
✅ Kept |
✅ Stripped – Removed only for API request |
| Thinking → Thinking provider |
✅ Preserved |
✅ Kept |
✅ Kept – Sent intact to destination model |
| Same model (no switch) |
✅ Preserved |
✅ Kept |
✅ Kept – No modification |
💡 The fix that's needed: Instead of stripping on every switch and deleting from session history, preserve thinking history in the session at all times. Only strip reasoning_content from the API request payload when the destination provider does not support it. This keeps full compatibility without permanently losing reasoning continuity for Qwen and other thinking‑capable models.
Client information
Qwen Code: 0.14.5 (a661294)
Runtime: Node.js v24.15.0 / npm 11.12.1
OS: win32 x64 (10.0.19045)
Auth: API Key - gemini
Session ID: 0e68e5df-a6f0-4de4-84c3-149b157af479
Sandbox: no sandbox
Proxy: no proxy
Memory Usage: 375.2 MB
Login information
No response
Anything else we need to know?
No response
What happened?
📋 Overview
PR #3315 fixes Issue #3304: switching from a "thinking" model to a strict provider caused
422API errors due to leakedreasoning_contentfields. The fix works—it strips the field on every model switch, ensuring cross‑provider compatibility.Why this is an issue: thinking stripping is unconditional. Even when switching between two thinking‑capable models, reasoning context is removed unnecessarily, reducing output quality on complex tasks.
📊 Qwen-Code Behavior Before and After the Fix
stripThoughtsFromHistory()calledstripThoughtsFromHistory()calledQwen-Code is built for DashScope and Qwen's thinking‑first model direction. Under the current fix, every switch permanently deletes reasoning history—hurting Qwen models and any thinking model like Gemini. The application discards the very context it was designed to leverage, working against its own future.
👤 Impact on Users
Switching between two thinking‑capable models (e.g.,
qwen3.6-plus→ Gemini 1.5 Pro) now stripsreasoning_contentmid‑conversation. The second model receives less context than it can handle, breaking multi‑step reasoning continuity and degrading output on complex tasks.What did you expect to happen?
✅ Expected Outcome
All scenarios should ideally be ✅:
Currently, the fix ensures safety but not full capability. The merge permanently deletes thinking history from the chat session on any model switch, even when preservation would be both valid and beneficial.
🎯 Desired Behavior (With Provider-Aware Stripping)
Client information
Qwen Code: 0.14.5 (a661294)
Runtime: Node.js v24.15.0 / npm 11.12.1
OS: win32 x64 (10.0.19045)
Auth: API Key - gemini
Session ID: 0e68e5df-a6f0-4de4-84c3-149b157af479
Sandbox: no sandbox
Proxy: no proxy
Memory Usage: 375.2 MB
Login information
No response
Anything else we need to know?
No response