Repository navigation
feat: add concurrent runner for batch CLI execution - #1640
Merged
Merged
Conversation
Add a Python-based concurrent runner that executes multiple Qwen CLI tasks
across different models in parallel using isolated git worktrees.
Features:
- Execute N tasks × M models concurrently with configurable concurrency
- Create isolated git worktrees for each run under ~/.qwen/worktrees
- Real-time progress display with Rich library
- Capture stdout, stderr, and OpenAI API logs per run
- Atomic JSON tracking of all runs with status and metadata
- Automatic cleanup of worktrees after each run
Structure:
- runner.py: Main implementation with asyncio
- requirements.txt: Python dependencies
- README.md: Documentation and usage
- config.example.json: Configuration template
- examples/: Toy example with sample config and project
Usage:
python runner.py config.json
Each run creates an isolated output directory:
outputs/{run_id}/
├── stdout.txt
├── stderr.txt
└── logs/openai-*.json
Co-authored-by: Qwen-Coder <[email protected]>
tanzhenxin
requested review from
DennisYu07,
LaZzyMan,
Mingholy,
gwinthis and
pomelo-nwu
as code owners
January 28, 2026 04:10
Contributor
📋 Review SummaryThis PR introduces a comprehensive concurrent runner for executing multiple Qwen CLI tasks across different models in parallel using isolated git worktrees. The implementation is well-structured with proper async handling, status tracking, and cleanup mechanisms. The feature enables efficient batch testing and benchmarking capabilities. 🔍 General Feedback
🎯 Specific Feedback🔴 CriticalNo specific critical issues identified in this review. 🟡 High
🟢 Medium
🔵 Low
✅ Highlights
|
Contributor
Code Coverage Summary
CLI Package - Full Text ReportCore Package - Full Text ReportFor detailed HTML reports, please see the 'coverage-reports-22.x-ubuntu-latest' artifact from the main CI run. |
Enhance the concurrent runner with two key features: 1. Sequential Prompt Execution: - Run multiple prompts sequentially instead of joining them - Use --continue flag for prompts 2+ to pick up chat history - Generate separate output files per prompt (stdout-1.txt, stdout-2.txt, etc.) - Stop execution if any prompt fails - Track per-prompt results in results.json 2. Auto Git Initialization: - Automatically initialize git repo if source is not a git repository - Run git init → git add . → git commit automatically - Improves UX - users can point runner at any directory Changes: - Add PromptResult dataclass for per-prompt tracking - Modify RunRecord to include prompt_results list - Update QwenRunner.run() to execute prompts sequentially - Add GitWorktreeManager.ensure_git_repo() method - Update _build_command() to support --continue flag Co-authored-by: Qwen-Coder <[email protected]>
Add optional branch configuration to specify which git branch to use for worktree creation. Features: - New branch config option to specify base branch (e.g., main, develop) - Each worktree creates a unique branch based on the specified branch (format: branch-run-id) - If branch is not specified, uses the repository default branch - Falls back gracefully when branch already exists Changes: - Add branch field to RunConfig dataclass - Update GitWorktreeManager.create() to accept branch parameter - Create unique branches for each worktree to avoid conflicts - Update load_config() to parse branch from config - Update config.example.json with branch option - Update README.md documentation Co-authored-by: Qwen-Coder <[email protected]>
…unner
- Add git diff capture after each run, saved as diff.patch
- Add session log collection from ~/.qwen/projects/{id}/chats/
- Store session logs in outputs/{run_id}/chats/ with original filename
- Add session_id field to track chat recording UUID
- Modify cwd in session logs to actual runner working directory
- Remove stdout_file/stderr_file from top-level, keep only in prompt_results
- Rename logs folder to openai-logs
- Add File Writer task example for testing file creation
Co-authored-by: Qwen-Coder <[email protected]>
- Move output-{N}.json and stderr-{N}.txt to outputs/ subdirectory
- Fix typo in toy-config.json results_file path (rest-run -> test-run)
- Add --output-format json to CLI commands
- Update file extensions from .txt to .json for stdout captures
Co-authored-by: Qwen-Coder <[email protected]>
- Remove --output-format json from CLI commands
- Change output filenames from output-{N}.json back to stdout-{N}.txt
- Keep outputs in outputs/ subdirectory for clean structure
Co-authored-by: Qwen-Coder <[email protected]>
- Remove npm install and npm run build from worktree initialization - Remove INITIALIZING status enum and related code - Add keep_worktree config option (default: false) - When keep_worktree is true, worktree is preserved for debugging - Renumber execution steps after removing initialize step Co-authored-by: Qwen-Coder <[email protected]>
- Resolve worktree_dir to absolute path before using as cwd and QWEN_CODE_ROOT - Load keep_worktree option from JSON config in load_config() Co-authored-by: Qwen-Coder <[email protected]>
pomelo-nwu
approved these changes
Jan 29, 2026
| { | ||
| "concurrency": 2, | ||
| "yolo": true, | ||
| "source_repo": "/Users/andy/workspace/projects/qwen-code/integration-tests/concurrent-runner/examples/toy-project", |
xaelistic
pushed a commit
to xaelistic/qwen-code
that referenced
this pull request
Jun 7, 2026
feat: add concurrent runner for batch CLI execution
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TLDR
Add a Python-based concurrent runner that executes multiple Qwen CLI tasks across different models in parallel using isolated git worktrees. This enables efficient batch testing and benchmarking of multiple tasks against multiple models.
Dive Deeper
The concurrent runner solves the problem of running multiple CLI tasks across different models efficiently. Instead of running tasks sequentially, it leverages asyncio and git worktrees to execute N tasks × M models concurrently with configurable parallelism.
Key Features:
~/.qwen/worktrees, ensuring clean environmentsoutputs/{run_id}/)Architecture:
GitWorktreeManager: Handles worktree creation, npm initialization, and cleanupStatusTracker: Thread-safe JSON persistence for run stateProgressDisplay: Rich-based live terminal UIQwenRunner: CLI execution with output captureReviewer Test Plan
pip install -r integration-tests/concurrent-runner/requirements.txtcd integration-tests/concurrent-runner/examples/toy-project && git init && git add . && git commit -m "init"cd .. && python ../runner.py toy-config.jsonexamples/outputs/{run_id}/examples/results.jsonfor run trackingTesting Matrix
Tested on macOS with npm-based toy project
Linked issues / bugs
None - this is a new feature addition.
🤖 Generated with Qwen Code