Fold Claude Code's in-conversation system turns so Qwen accepts them - #77
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthrough
ChangesSystem message translation
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: Merge Risk: ⚪ Minimal · up to System turns are consolidated into one leading message and removed from the conversation as intended. No merge-blocking risk was identified. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Claude Code on qwen3.8-27b fails every request through wally with
400 System message must be at the beginning.glm-5.3-flash and gemma-4 work.Claude Code 2.1.268 sends a
role: "system"turn insidemessages(its environment block, after the first user turn), on top of the top-levelsystemfield.RequestToOpenAIpassed roles through as-is, so the upstream got[system, user, system]. Qwen's chat template rejects a system message anywhere but first; the other two accept it.The shim now folds every system turn into the one leading system message, in order, and leaves none in the conversation.
Found by capturing Claude Code's real requests through
wally claude-code --serveon dev. The new unit test uses that captured shape.Checks:
translate.cppthe new test fails (a system message sits at index 2); with the fix it passes.test_wally_unit --run-all: 43 passed.wally claude-code -panswers on qwen3.8-27b, glm-5.3-flash and gemma-4.GLM and Gemma now get the environment text at the top of the system prompt instead of mid-conversation. Nothing else changes for them.
Summary by CodeRabbit