qwen-code/integration-tests/concurrent-runner
顾盼 aeeb2976d6
feat(web-search): remove built-in web_search tool, replace with MCP-based approach (#3502)
* feat(web-search): add GLM (ZhipuAI) web search provider

- Add GlmProvider class implementing BaseWebSearchProvider using the
  ZhipuAI Web Search API (https://open.bigmodel.cn/api/paas/v4/web_search)
- Support multiple search engines: search_std, search_pro, search_pro_sogou,
  search_pro_quark
- Support optional config: maxResults, searchIntent, searchRecencyFilter,
  contentSize, searchDomainFilter
- Truncate query to 70 characters per API limit
- Register 'glm' in the provider discriminated union (types.ts) and
  createProvider() switch (index.ts)
- Add GlmProviderConfig to settingsSchema, ConfigParams, and Config class
- Add --glm-api-key CLI flag and GLM_API_KEY env var support in webSearch.ts
- Forward GLM_API_KEY in sandbox environment
- Update provider priority list: Tavily > Google > GLM > DashScope
- Add 17 unit tests for GlmProvider and 4 integration tests in index.test.ts
- Update docs/developers/tools/web-search.md with GLM configuration,
  env vars, CLI args, pricing, and corrected DashScope billing info
- Fix stale OAuth/free-tier references in web-search.md

Closes #3496

* docs(web-search): fix DashScope note and add GLM server-side limitations

* fix(web-search): make DashScope provider work with standard API key, remove qwen-oauth dependency

- DashScopeProvider.isAvailable() now checks config.apiKey instead of authType
- Remove OAuth credential file reading and resource_url requirement
- Use standard DashScope endpoint: dashscope.aliyuncs.com/api/v1/indices/plugin/web_search
- Read DASHSCOPE_API_KEY env var and --dashscope-api-key CLI flag
- Forward DASHSCOPE_API_KEY into sandbox environment
- Update integration test to detect DASHSCOPE_API_KEY
- Update docs to reflect new API key based configuration

* feat(web-search): remove built-in web search tool

The web_search tool and all related provider implementations are removed.
Web search functionality will be provided via MCP integrations instead,
which is the direction the broader agent ecosystem is moving.

Removed:
- packages/core/src/tools/web-search/ (entire directory)
- packages/cli/src/config/webSearch.ts
- integration-tests/cli/web_search.test.ts
- ToolNames.WEB_SEARCH, ToolErrorCode.WEB_SEARCH_FAILED
- webSearch config in ConfigParams, Config class, settingsSchema
- CLI options: --tavily-api-key, --google-api-key, --google-search-engine-id,
  --glm-api-key, --dashscope-api-key, --web-search-default
- Sandbox env forwarding for TAVILY/GLM/DASHSCOPE/GOOGLE search keys
- web_search from rule-parser, permission-manager, speculation gate,
  microcompact tool set, and builtin-agents tool list

* fix: remove websearch reference

* docs: remove websearch tool

* docs: add break change guide

* fix review
2026-04-24 11:29:02 +08:00
..
examples feat: remove npm install/build and add keep_worktree option 2026-01-28 16:43:50 +08:00
config.example.json feat(runner): support auth_type for model configuration 2026-02-19 11:55:42 +08:00
export-html-from-chatrecord-jsonl.js feat(web-search): remove built-in web_search tool, replace with MCP-based approach (#3502) 2026-04-24 11:29:02 +08:00
README.md feat: add git branch support for worktree creation 2026-01-28 12:36:23 +08:00
render-chat-temp.html style: apply formatting and linting fixes across codebase 2026-03-06 21:58:22 +08:00
requirements.txt feat: add concurrent runner for batch CLI execution 2026-01-28 12:08:56 +08:00
runner.py feat(runner): support auth_type for model configuration 2026-02-19 11:55:42 +08:00

Qwen Concurrent Runner

A Python tool for executing multiple Qwen CLI tasks across different models concurrently using isolated git worktrees.

Overview

This tool enables you to:

  • Run multiple tasks against multiple models in parallel
  • Create isolated git worktrees for each execution
  • Track execution status in real-time
  • Capture and store all outputs (stdout, stderr, and OpenAI logs)
  • Resume or analyze results after completion

Installation

# Install dependencies
pip install -r requirements.txt

Usage

python runner.py config.json

Configuration

Create a JSON configuration file (see config.example.json):

{
  "concurrency": 3,
  "yolo": true,
  "source_repo": ".",
  "worktree_base": "~/.qwen/worktrees",
  "outputs_dir": "./outputs",
  "results_file": "./results.json",
  "tasks": [
    {
      "id": "code-review",
      "name": "Security Code Review",
      "prompts": ["Review the codebase for security vulnerabilities."]
    }
  ],
  "models": ["claude-3-5-sonnet-20241022", "qwen3-coder-plus"]
}

Configuration Options

Option Type Default Description
concurrency int 4 Maximum parallel executions
yolo bool true Auto-approve all actions
source_repo string . Source git repository path
branch string null Git branch to checkout (uses default if null)
worktree_base string ~/.qwen/worktrees Base directory for git worktrees
outputs_dir string ./outputs Directory for captured output
results_file string ./results.json JSON file for run tracking
tasks array [] List of task definitions
models array [] List of model identifiers

Task Definition

Each task has:

  • id: Unique identifier
  • name: Human-readable name
  • prompts: Array of prompt strings (joined with newlines)

Output Structure

Each run creates an isolated output directory:

outputs/
├── {run_id}/
│   ├── stdout.txt        # CLI stdout
│   ├── stderr.txt        # CLI stderr
│   └── logs/             # OpenAI API logs
│       └── openai-*.json

results.json

{
  "updated_at": "2026-01-28T10:30:00",
  "runs": [
    {
      "run_id": "abc123",
      "task_id": "code-review",
      "task_name": "Security Code Review",
      "model": "qwen3-coder-plus",
      "status": "succeeded",
      "worktree_path": "~/.qwen/worktrees/run-abc123",
      "output_dir": "outputs/abc123",
      "logs_dir": "outputs/abc123/logs",
      "started_at": "2026-01-28T10:00:00",
      "ended_at": "2026-01-28T10:05:00",
      "exit_code": 0,
      "stdout_file": "outputs/abc123/stdout.txt",
      "stderr_file": "outputs/abc123/stderr.txt"
    }
  ]
}

Execution Flow

  1. Generate Matrix: Create N×M run combinations (tasks × models)
  2. Create Worktree: Git worktree add from source repo
  3. Initialize: npm install && npm run build
  4. Execute: Run qwen CLI with captured output (logs go to run-specific folder)
  5. Cleanup: Remove git worktree (always executed)

Status Values

  • queued: Waiting to start
  • preparing: Creating git worktree
  • initializing: Running npm install + build
  • running: Executing qwen CLI
  • succeeded: Completed successfully
  • failed: Error occurred

Requirements

  • Python 3.10+
  • Git repository (for worktree operations)
  • Node.js and npm (for build step)
  • qwen CLI in PATH

Exit Codes

  • 0: All runs succeeded
  • 1: One or more runs failed
  • 130: Interrupted by user (Ctrl+C)