Skip to content

feat: Add Qwen CLI provider support#1743

Closed
dome wants to merge 0 commit intosipeed:mainfrom
domeclaw:main
Closed

feat: Add Qwen CLI provider support#1743
dome wants to merge 0 commit intosipeed:mainfrom
domeclaw:main

Conversation

@dome
Copy link

@dome dome commented Mar 18, 2026

Add support for Qwen Code CLI (qwen) as a new LLM provider. This enables users to use the qwen CLI tool as a provider, similar to the existing claude-cli and codex-cli providers.

Changes:

  • Add QwenCliProvider implementation with JSON event parsing
  • Add comprehensive unit tests (32 test cases)
  • Register qwen-cli protocol in factory_provider.go
  • Add providerTypeQwenCLI in factory.go
  • Add qwen-code to default model list in defaults.go

📝 Description

🗣️ Type of Change

  • 🐞 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 📖 Documentation update
  • ⚡ Code refactoring (no functional changes, no api changes)

🤖 AI Code Generation

  • 🤖 Fully AI-generated (100% AI, 0% Human)
  • 🛠️ Mostly AI-generated (AI draft, Human verified/modified)
  • 👨‍💻 Mostly Human-written (Human lead, AI assisted or none)

🔗 Related Issue

📚 Technical Context (Skip for Docs)

  • Reference URL:
  • Reasoning:

🧪 Test Environment

  • Hardware:
  • OS:
  • Model/Provider:
  • Channels:

📸 Evidence (Optional)

Click to view Logs/Screenshots

☑️ Checklist

  • My code/docs follow the style of this project.
  • I have performed a self-review of my own changes.
  • I have updated the documentation accordingly.

Copilot AI review requested due to automatic review settings March 18, 2026 09:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new local LLM provider that shells out to the qwen CLI, integrating it into the provider factory and default configuration so it can be selected via qwen-cli/... model refs.

Changes:

  • Introduces QwenCliProvider that runs qwen as a subprocess and parses its JSON event output into LLMResponse.
  • Wires qwen-cli into provider creation (CreateProviderFromConfig) and provider selection logic.
  • Adds comprehensive unit tests plus a default model_list entry for qwen-cli/qwen-code.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pkg/providers/qwen_cli_provider.go Implements the new CLI-backed provider (prompt building, subprocess execution, JSON event parsing).
pkg/providers/qwen_cli_provider_test.go Adds unit tests for Chat(), prompt building, JSON parsing, and factory integration.
pkg/providers/factory.go Adds qwen-cli to provider selection (workspace resolution).
pkg/providers/factory_provider.go Adds qwen-cli protocol support to CreateProviderFromConfig.
pkg/config/defaults.go Adds a default model_list entry for qwen-cli/qwen-code.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}
}
case "error":
lastError = event.Error.Message
Comment on lines +73 to +80
if err != nil {
if ctx.Err() == context.Canceled {
return nil, ctx.Err()
}
if stderrStr := stderr.String(); stderrStr != "" {
return nil, fmt.Errorf("qwen cli error: %s", stderrStr)
}
return nil, fmt.Errorf("qwen cli error: %w", err)
@yinwm
Copy link
Collaborator

yinwm commented Mar 18, 2026

@dome plz resolve conflicts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants