← Back to PRs

#23711: fix: disable developer role for DashScope/Qwen models (#23575)

by echoVic open 2026-02-22 16:23 View on GitHub →
agents size: S trusted-contributor
## Summary Fixes #23575 — DashScope (Aliyun/Bailian) API returns HTTP 400 when `reasoning: true` because it doesn't support the `developer` role. ## Root Cause When `reasoning: true`, OpenClaw converts the `system` role to `developer` (following OpenAI's convention). DashScope's OpenAI-compatible API only accepts `system/user/assistant/tool`, so it rejects the request with: ``` HTTP 400: developer is not one of ['system', 'assistant', 'user', 'tool', 'function'] ``` ## Fix Extend `normalizeModelCompat` to detect DashScope/Bailian providers and Qwen models, automatically setting `supportsDeveloperRole: false` so the `system` role is preserved. Detection covers: - `provider='bailian'` or `'dashscope'` - `baseUrl` containing `dashscope.aliyuncs.com` - `modelId` containing `qwen` (via any provider) Refactored the existing zai-only check into a general `needsDeveloperRoleDisabled` function for cleaner extensibility. Users can still manually override via `compat.supportsDeveloperRole: true` in their model config if needed. ## Testing - `model-compat.test.ts` — 5/5 ✅ (added 2 new test cases for DashScope and Qwen) <!-- greptile_comment --> <h3>Greptile Summary</h3> Extends DashScope/Qwen compatibility detection to prevent HTTP 400 errors when `reasoning: true` by automatically disabling the `developer` role conversion. The fix refactors the existing z.ai-only check into a general `needsDeveloperRoleDisabled()` function that now detects: - `provider='bailian'` or `'dashscope'` - `baseUrl` containing `dashscope.aliyuncs.com` - `modelId` containing `qwen` (via any provider) The implementation follows the existing pattern established for z.ai models and is well-tested with 2 new test cases covering DashScope providers and Qwen models via custom providers. <h3>Confidence Score: 5/5</h3> - This PR is safe to merge with no identified issues - The implementation is clean, follows existing patterns, has comprehensive test coverage (5/5 tests passing), and addresses the reported issue correctly. The refactoring improves code organization and maintainability while preserving backward compatibility. - No files require special attention <sub>Last reviewed commit: 029694e</sub> <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs