-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: Add Qwen Code CLI API Support with OAuth Authentication #7380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Add QwenCodeHandler with OAuth2 authentication flow - Support automatic token refresh with 30-second buffer - Add configurable OAuth credential paths (supports ~/ expansion) - Integrate Qwen Code models (qwen3-coder-plus, qwen3-coder-flash) - Add UI components for OAuth path configuration - Include setup instructions and documentation links - Add validation for required OAuth credentials Implements comprehensive support for Qwen advanced coding models with enterprise-grade OAuth2 authentication, based on PR #5766 from Cline repository.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewing my own code is like debugging in a mirror - everything looks backwards and I still can't find the bug.
|
|
||
| return response.choices[0]?.message.content || "" | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical: No test coverage for this OAuth provider implementation. We need comprehensive tests for:
- Token refresh logic
- Authentication failures
- API retry mechanism
- Credential file operations
Could we add tests similar to other providers in the codebase?
- Add missing qwenCodeOauthPath validation message to all 18 language files - Ensures proper error messages for OAuth path validation - Translations are culturally appropriate for each locale
- Changed value prop to show empty string instead of default path - Default path only appears as placeholder - On blur, if field is empty, it sets the default path in config - Removed redundant element.value assignment in handleBlur This prevents the default path from immediately appearing while typing/deleting
- Replaced all inline styles with Tailwind utility classes - Uses consistent text sizing with text-xs - Uses VSCode color variables through Tailwind classes - Maintains same visual appearance with cleaner code
- Import qwenCodeModels from @roo-code/types - Add qwen-code to MODELS_BY_PROVIDER mapping - Add Qwen Code to PROVIDERS list for UI dropdown This fixes the issue where Qwen Code was not appearing as a selectable provider in the settings UI
- Add mutex/promise-based deduplication to prevent race conditions in token refresh - Add error handling for credential file write operations - Ensure only one token refresh happens at a time for concurrent requests - Continue with refreshed token in memory if file write fails Addresses review feedback from PR #7380
daniel-lxs
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…tion - Added qwen-code to the list of providers in checkExistKey that can proceed without API keys - This allows qwen-code to use its default OAuth path (~/.qwen/oauth_creds.json) without blocking the Welcome View - Treats qwen-code similar to claude-code and other local authentication providers
- Import qwenCodeModels from providers - Remove qwen-code from the Exclude list in MODELS_BY_PROVIDER type - Add qwen-code entry with its models to MODELS_BY_PROVIDER object
|
Thank you for merging my PR. Means a lot! ❤🙏🏻 |
Description
This PR implements comprehensive support for Qwen's advanced coding models with enterprise-grade OAuth2 authentication, based on PR #5766 from the Cline repository.
Features
🔐 OAuth2 Authentication
🤖 Model Support
🎨 UI Integration
🛠️ Technical Implementation
QwenCodeHandlerclass extendingBaseProviderChanges
Added
src/api/providers/qwen-code.ts- Core OAuth provider implementationpackages/types/src/providers/qwen-code.ts- Model definitions and typeswebview-ui/src/components/settings/providers/QwenCode.tsx- UI component for settingsModified
packages/types/src/provider-settings.ts- Added qwen-code to provider names and schemaspackages/types/src/providers/index.ts- Exported Qwen Code models and typessrc/api/index.ts- Integrated QwenCodeHandler into API routingsrc/api/providers/index.ts- Exported QwenCodeHandlerwebview-ui/src/components/settings/ApiOptions.tsx- Added Qwen Code to provider optionswebview-ui/src/components/settings/providers/index.ts- Exported QwenCode componentwebview-ui/src/components/ui/hooks/useSelectedModel.ts- Added Qwen Code model selection supportwebview-ui/src/utils/validate.ts- Added validation for Qwen Code OAuth pathTesting
Documentation
The implementation includes:
Breaking Changes
None - this is a purely additive feature that doesn't affect existing functionality.
Related Issues
Checklist
Important
Adds Qwen Code CLI API support with OAuth authentication, including UI and validation updates.
qwen3-coder-plusandqwen3-coder-flashmodels.QwenCode.tsx.validate.tsto includeqwen-codeOAuth path validation.qwenCodeOauthPathvalidation message in multiple locale files.This description was created by
for 70f3bbe. You can customize this summary. It will automatically update as commits are pushed.