#23655: fix(model): map developer role to system for Aliyun/Dashscope/Qianfan providers
agents
size: S
Cluster:
DashScope/Qwen Role Management
## Summary
Aliyun/Dashscope, Qwen Portal, and Qianfan (Baidu) implement OpenAI-compatible APIs but reject the newer "developer" role, returning `InvalidParameter` errors. This extends `normalizeModelCompat()` to detect these providers and set `supportsDeveloperRole: false`.
Supersedes #13779 (rebased against current HEAD after upstream changes to model-compat.ts).
Fixes #13633
## Changes
- **model-compat.ts**: Expand provider detection from Z.AI-only to include Dashscope, Qwen Portal, and Qianfan (by provider name or base URL pattern). Support both `openai-completions` and `openai-responses` API types.
- **pi-embedded-runner/model.ts**: Propagate user-configured model properties (`reasoning`, `input`, `cost`, `compat`) from matched provider config entry instead of hardcoding defaults in the fallback model construction.
- **model-compat.test.ts**: 5 new test cases covering all affected providers + Anthropic passthrough.
## Test plan
- [ ] All 8 model-compat tests pass (`npx vitest run src/agents/model-compat.test.ts`)
- [ ] Qwen model via Dashscope URL → `supportsDeveloperRole: false` applied
- [ ] Provider with `compat` flags in config → flags propagated to fallback model
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Extends `normalizeModelCompat()` to disable the OpenAI "developer" role for Aliyun/Dashscope, Qwen Portal, and Qianfan providers that reject it with `InvalidParameter` errors.
**Key changes:**
- Generalizes provider detection to support both `openai-completions` and `openai-responses` APIs
- Adds URL pattern matching for dashscope.aliyuncs.com, portal.qwen.ai, and qianfan.baidubce.com
- Propagates user-configured model properties (`reasoning`, `input`, `cost`, `compat`) in pi-embedded-runner fallback model construction
- Adds comprehensive test coverage for all affected providers
**Issue found:**
- Missing `"aliyun"` provider name check in `isDeveloperRoleUnsupportedProvider()` - test uses `provider: "aliyun"` but function only checks URL patterns for Aliyun, not the provider name itself
<h3>Confidence Score: 3/5</h3>
- PR has a logical error that will cause test failure for Aliyun provider detection
- The implementation is mostly solid with good test coverage and proper handling of provider detection patterns. However, there's a critical bug: the test expects `provider: "aliyun"` to be detected, but the provider name check only includes `"zai"`, `"qwen-portal"`, and `"qianfan"` - missing `"aliyun"`. The URL pattern will catch dashscope.aliyuncs.com, but direct provider name matching won't work. This will cause the test on line 49-60 to fail.
- `src/agents/model-compat.ts` needs the missing `"aliyun"` provider check added
<sub>Last reviewed commit: 379e0a4</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#22741: fix(models): add DashScope/Qwen to normalizeModelCompat developer r...
by lailoo · 2026-02-21
84.2%
#23711: fix: disable developer role for DashScope/Qwen models (#23575)
by echoVic · 2026-02-22
82.6%
#14187: fix: add Moonshot AI to non-standard provider detection
by shad0wca7 · 2026-02-11
80.0%
#16766: fix(model): apply provider baseUrl/headers override to registry-fou...
by dzianisv · 2026-02-15
79.8%
#11297: fix: add thinkingFormat 'qwen' compat for bailian/dashscope providers
by AdJIa · 2026-02-07
78.2%
#19281: fix: set supportsDeveloperRole false as default for moonshot provider
by MisterGuy420 · 2026-02-17
77.3%
#22175: fix: support xai tool stream and compat flags
by ShunsukeHayashi · 2026-02-20
76.8%
#7570: fix: allow models from providers with auth profiles configured
by DonSqualo · 2026-02-03
76.8%
#14508: fix(models): allow forward-compat models in allowlist check
by jonisjongithub · 2026-02-12
76.7%
#9905: fix: require provider prefix for models set without alias (#5790)
by petter-b · 2026-02-05
76.1%