Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
feat(runtime): add Qwen Code runtime (MUL-5015)
Bowserf8bf6cd8b929
diff --git a/CLI_AND_DAEMON.md b/CLI_AND_DAEMON.mdindex c634a79916..180ee23fcc 100644--- a/CLI_AND_DAEMON.md+++ b/CLI_AND_DAEMON.md@@ -152,6 +152,7 @@ The daemon auto-detects these AI CLIs on your PATH:| [Qoder CLI](https://docs.qoder.com/) | `qodercli` | Qoder ACP coding agent || [Trae](https://docs.trae.cn/cli) | `traecli` | ByteDance TRAE CLI (ACP via `traecli acp serve`) || [Grok Build CLI](https://docs.x.ai/) | `grok` | xAI Grok Build CLI (ACP via `grok agent stdio`) |+| [Qwen Code](https://github.com/QwenLM/qwen-code) | `qwen` | Alibaba Qwen Code (`qwen -p` with stream-json) |You need at least one installed. The daemon registers each detected CLI as an available runtime.@@ -230,12 +231,17 @@ Agent-specific overrides:| `MULTICA_TRAECLI_MODEL` | Override the Trae model used (a model id from your logged-in traecli catalog, e.g. `Doubao-Seed-2.1-Pro`) || `MULTICA_GROK_PATH` | Custom path to the `grok` binary (defaults to `grok` on PATH; often `~/.grok/bin/grok`) || `MULTICA_GROK_MODEL` | Override the Grok model used (e.g. `grok-4.5`) |+| `MULTICA_QWEN_PATH` | Custom path to the `qwen` binary |+| `MULTICA_QWEN_MODEL` | Override the Qwen Code model used |+| `MULTICA_QWEN_ARGS` | Daemon-wide extra Qwen arguments (POSIX shellword parsing; managed protocol flags are filtered) |If a previously generated `~/.multica/hooks` wrapper is first on `PATH` and calls the same command name again, the daemon skips that hooks directory during built-in agent discovery and records the real binary path behind it. If your interactive shell still recurses when you run `claude`, `codex`, or `hermes` manually, remove the hooks entry from your shell startup file or replace the wrapper body with an absolute `exec /path/to/real-binary "$@"`.The daemon launches Qoder as `qodercli --yolo --acp`, matching Qoder’s ACP “bypass permissions” mode so tool runs do not block on interactive approval in headless runs.+The daemon launches Qwen Code as `qwen -p <prompt> --output-format stream-json`. It writes the task brief to `QWEN.md`; when an agent has managed `mcp_config`, the daemon writes a 0600 per-run JSON file and passes it through `--mcp-config <path>`, then removes it after the process exits. A null config preserves Qwen Code native MCP settings.-`MULTICA_CLAUDE_ARGS` and `MULTICA_CODEX_ARGS` are parsed with POSIX shellword quoting, so values such as `--model "gpt-5.1 codex" --sandbox read-only` are split like a shell command line. Agent arguments are applied in this order: hardcoded Multica defaults, daemon-wide env defaults, then per-agent `custom_args` from the task.++`MULTICA_CLAUDE_ARGS`, `MULTICA_CODEX_ARGS`, and `MULTICA_QWEN_ARGS` are parsed with POSIX shellword quoting, so values such as `--model "gpt-5.1 codex" --sandbox read-only` are split like a shell command line. Agent arguments are applied in this order: hardcoded Multica defaults, daemon-wide env defaults, then per-agent `custom_args` from the task.### Self-Hosted Serverdiff --git a/SELF_HOSTING.md b/SELF_HOSTING.mdindex 635b225ce0..2fdd8b2fb7 100644--- a/SELF_HOSTING.md+++ b/SELF_HOSTING.md@@ -103,6 +103,7 @@ You also need at least one AI agent CLI installed:- Qoder CLI (`qodercli` on PATH)- Trae CLI (`traecli` on PATH)- [Grok Build CLI](https://docs.x.ai/) (`grok` on PATH)+- Qwen Code (`qwen` on PATH)### b) One-command setupdiff --git a/apps/docs/content/docs/daemon-runtimes.mdx b/apps/docs/content/docs/daemon-runtimes.mdxindex 3f6fdc55f7..63ea6b60e3 100644--- a/apps/docs/content/docs/daemon-runtimes.mdx+++ b/apps/docs/content/docs/daemon-runtimes.mdx@@ -21,7 +21,7 @@ multica daemon startOn startup it does four things:1. Reads the credentials saved when you logged in-2. Detects AI coding tools installed on your `PATH` (16 built-in: [Antigravity](/providers#antigravity), [Claude Code](/providers#claude-code), [CodeBuddy](/providers#codebuddy), [Codex](/providers#codex), [Cursor](/providers#cursor), [Copilot](/providers#copilot), [Hermes](/providers#hermes), [Kimi](/providers#kimi), [Kiro CLI](/providers#kiro-cli), [OpenCode](/providers#opencode), [OpenClaw](/providers#openclaw), [Pi](/providers#pi), [Qoder](/providers#qoder), [Trae CLI](/providers#trae), [DevEco Code](/providers#deveco-code), [Grok](/providers#grok))+2. Detects AI coding tools installed on your `PATH` (17 built-in: [Antigravity](/providers#antigravity), [Claude Code](/providers#claude-code), [CodeBuddy](/providers#codebuddy), [Codex](/providers#codex), [Cursor](/providers#cursor), [Copilot](/providers#copilot), [Hermes](/providers#hermes), [Kimi](/providers#kimi), [Kiro CLI](/providers#kiro-cli), [OpenCode](/providers#opencode), [OpenClaw](/providers#openclaw), [Pi](/providers#pi), [Qoder](/providers#qoder), [Qwen Code](/providers#qwen-code), [Trae CLI](/providers#trae), [DevEco Code](/providers#deveco-code), [Grok](/providers#grok))3. Registers itself with the server, along with a runtime for each detected tool4. Keeps **polling every 3 seconds** for tasks to pick up, and **sends a heartbeat every 15 seconds**@@ -189,4 +189,4 @@ More scenarios in [Troubleshooting](/troubleshooting).## Next- [Tasks](/tasks) — the full lifecycle of a task once the daemon picks it up-- [Providers Matrix](/providers) — capability differences across the 16 AI coding tools+- [Providers Matrix](/providers) — capability differences across the 17 AI coding toolsdiff --git a/apps/docs/content/docs/how-multica-works.mdx b/apps/docs/content/docs/how-multica-works.mdxindex c064e0283a..e4ef4698be 100644--- a/apps/docs/content/docs/how-multica-works.mdx+++ b/apps/docs/content/docs/how-multica-works.mdx@@ -13,7 +13,7 @@ Multica is a **distributed** platform. The web interface you see is just the fro- **Multica server** — the workspaces, issue lists, and comment threads you see all live in its database. It's also a WebSocket hub that pushes real-time updates between you and your teammates. It does **not** execute any agent tasks.- **Daemon** — part of the Multica CLI, running on your own machine. On start it detects which AI coding tools are installed locally, registers with the server, and begins polling for tasks every 3 seconds and sending heartbeats every 15 seconds.-- **AI coding tools** — one of the sixteen (or several in parallel): [Antigravity](/providers#antigravity), [Claude Code](/providers#claude-code), [CodeBuddy](/providers#codebuddy), [Codex](/providers#codex), [Cursor](/providers#cursor), [Copilot](/providers#copilot), [Hermes](/providers#hermes), [Kimi](/providers#kimi), [Kiro CLI](/providers#kiro-cli), [OpenCode](/providers#opencode), [OpenClaw](/providers#openclaw), [Pi](/providers#pi), [Qoder](/providers#qoder), [Trae CLI](/providers#trae), [DevEco Code](/providers#deveco-code), [Grok](/providers#grok). Once the daemon has picked up a task, it uses these tools to actually do the work.+- **AI coding tools** — one of the seventeen (or several in parallel): [Antigravity](/providers#antigravity), [Claude Code](/providers#claude-code), [CodeBuddy](/providers#codebuddy), [Codex](/providers#codex), [Cursor](/providers#cursor), [Copilot](/providers#copilot), [Hermes](/providers#hermes), [Kimi](/providers#kimi), [Kiro CLI](/providers#kiro-cli), [OpenCode](/providers#opencode), [OpenClaw](/providers#openclaw), [Pi](/providers#pi), [Qoder](/providers#qoder), [Trae CLI](/providers#trae), [DevEco Code](/providers#deveco-code), [Grok](/providers#grok), [Qwen Code](/providers#qwen-code). Once the daemon has picked up a task, it uses these tools to actually do the work.Because the toolchain stays local, **your API keys, code directories, and authorized tools** are only ever used on your machine — the Multica server never sees any of them. This holds whether you self-host or use Cloud.diff --git a/apps/docs/content/docs/index.mdx b/apps/docs/content/docs/index.mdxindex 912ca3fffa..1a765a6f4e 100644--- a/apps/docs/content/docs/index.mdx+++ b/apps/docs/content/docs/index.mdx@@ -13,7 +13,7 @@ This page explains where agents run and the ways you can start using Multica.Agents do **not** execute tasks on Multica's servers. Multica currently supports one runtime model:-- **Local [daemon](/daemon-runtimes)** — you run `multica daemon` on your own machine, and it drives the [AI coding tools](/providers) installed locally. Sixteen are built in today: [Antigravity](/providers#antigravity), [Claude Code](/providers#claude-code), [CodeBuddy](/providers#codebuddy), [Codex](/providers#codex), [Cursor](/providers#cursor), [Copilot](/providers#copilot), [Hermes](/providers#hermes), [Kimi](/providers#kimi), [Kiro CLI](/providers#kiro-cli), [OpenCode](/providers#opencode), [OpenClaw](/providers#openclaw), [Pi](/providers#pi), [Qoder](/providers#qoder), [Trae CLI](/providers#trae), [DevEco Code](/providers#deveco-code), [Grok](/providers#grok). Your API keys, toolchain, and code directories stay on your machine.+- **Local [daemon](/daemon-runtimes)** — you run `multica daemon` on your own machine, and it drives the [AI coding tools](/providers) installed locally. Seventeen are built in today: [Antigravity](/providers#antigravity), [Claude Code](/providers#claude-code), [CodeBuddy](/providers#codebuddy), [Codex](/providers#codex), [Cursor](/providers#cursor), [Copilot](/providers#copilot), [Hermes](/providers#hermes), [Kimi](/providers#kimi), [Kiro CLI](/providers#kiro-cli), [OpenCode](/providers#opencode), [OpenClaw](/providers#openclaw), [Pi](/providers#pi), [Qoder](/providers#qoder), [Trae CLI](/providers#trae), [DevEco Code](/providers#deveco-code), [Grok](/providers#grok), [Qwen Code](/providers#qwen-code). Your API keys, toolchain, and code directories stay on your machine.<Callout type="info">**Cloud runtimes are coming**, currently waitlist-only. Once live, you won't need a local daemon — agent tasks will execute on Multica Cloud directly. Sign up on the [Downloads](https://multica.ai/download) page to get notified.diff --git a/apps/docs/content/docs/install-agent-runtime.mdx b/apps/docs/content/docs/install-agent-runtime.mdxindex 16ea972713..973ef45de3 100644--- a/apps/docs/content/docs/install-agent-runtime.mdx+++ b/apps/docs/content/docs/install-agent-runtime.mdx@@ -1,11 +1,11 @@---title: Install an agent runtime-description: Multica drives whichever AI coding tools you have on your machine. This page shows you how to install each of the 16 supported tools so the daemon can detect them.+description: Multica drives whichever AI coding tools you have on your machine. This page shows you how to install each of the 17 supported tools so the daemon can detect them.---import { Callout } from "fumadocs-ui/components/callout";-A **runtime** in Multica is the daemon on your machine paired with one AI coding tool the daemon found on your `PATH`. If the onboarding "Connect a runtime" step shows **No supported tools detected**, it means the daemon scanned `PATH` and didn't find any of the 16 tools it knows how to drive. Install one (or several) of the tools below, then come back to the step and re-scan — the runtime will show up within a few seconds.+A **runtime** in Multica is the daemon on your machine paired with one AI coding tool the daemon found on your `PATH`. If the onboarding "Connect a runtime" step shows **No supported tools detected**, it means the daemon scanned `PATH` and didn't find any of the 17 tools it knows how to drive. Install one (or several) of the tools below, then come back to the step and re-scan — the runtime will show up within a few seconds.This page is the install-side companion to:@@ -31,9 +31,9 @@ multica daemon restartOr, in the desktop app, just relaunch the app. The daemon re-scans `PATH` on every start.-## The 16 supported tools+## The 17 supported tools-Listed roughly from most to least common. Pick whichever ones you already have credentials for — you don't need all 16.+Listed roughly from most to least common. Pick whichever ones you already have credentials for — you don't need all 17.### Claude Code (Anthropic)@@ -170,6 +170,17 @@ Agentic coding CLI using the ACP protocol over stdio (shares the transport with| Install | See the official CLI docs at [qoder.com/cli](https://qoder.com/cli). || Authentication | Per the vendor's docs. |+### Qwen Code (Alibaba)++Qwen Code uses its native JSONL protocol in daemon mode: `qwen -p <prompt> --output-format stream-json`. Session resumption works through `--resume`; the task runtime brief is written to `QWEN.md`; assigned skills are copied to `.qwen/skills/`; and personal skills use `$QWEN_HOME/skills/` (default `~/.qwen/skills/`).++| | |+|---|---|+| Daemon looks for | `qwen` |+| Install | Install Qwen Code using Alibaba's current Qwen Code instructions, then ensure `qwen` is on `PATH`. |+| Authentication | Run `qwen` once interactively and complete its configured authentication flow before starting the daemon. |+| Notes | Minimum CLI version: `0.20.0`. Override the binary with `MULTICA_QWEN_PATH` and set a daemon-wide default model with `MULTICA_QWEN_MODEL`. Add daemon-wide non-managed flags with `MULTICA_QWEN_ARGS` (POSIX shellword parsing). Managed agent `mcp_config` is written to a 0600 temporary JSON file and passed through `--mcp-config`; the file is removed after the run. Leave the field null to inherit native Qwen Code MCP settings. |+### Trae CLI (ByteDance)ByteDance's official TRAE CLI (`traecli`, paired with the Trae IDE — **not** the open-source `bytedance/trae-agent`). It is ACP-native, so Multica drives it over stdio via `traecli acp serve --yolo`, sharing the transport with Hermes, Kimi, Kiro CLI, and Qoder. Session resumption works through ACP `session/load`, MCP config is passed through ACP `mcpServers`, model selection is discovered dynamically (switched per task via `session/set_model`), and skills are copied into `.traecli/skills/`.diff --git a/apps/docs/content/docs/providers.mdx b/apps/docs/content/docs/providers.mdxindex cedd9a06f6..8f722bbbd7 100644--- a/apps/docs/content/docs/providers.mdx+++ b/apps/docs/content/docs/providers.mdx@@ -1,11 +1,11 @@---title: AI coding tools matrix-description: Multica supports 16 AI coding tools; they implement the same interface, but the capability details diverge significantly.+description: Multica supports 17 AI coding tools; they implement the same interface, but the capability details diverge significantly.---import { Callout } from "fumadocs-ui/components/callout";-Multica ships with built-in support for **16 AI coding tools**. They all implement the same interface — queue, dispatch, execute, return results — so you can drive any of them from the same Multica board. **But the capability details diverge significantly**: whether session resumption actually works, whether MCP is supported, where skill files live, how models are selected. This page is the full matrix.+Multica ships with built-in support for **17 AI coding tools**. They all implement the same interface — queue, dispatch, execute, return results — so you can drive any of them from the same Multica board. **But the capability details diverge significantly**: whether session resumption actually works, whether MCP is supported, where skill files live, how models are selected. This page is the full matrix.For guidance on picking a tool when creating an agent, see [Creating and configuring agents](/agents-create).@@ -27,6 +27,7 @@ For guidance on picking a tool when creating an agent, see [Creating and configu| **OpenClaw** | Open source | ✅ | ✅ | `.agent_context/skills/` (fallback) | Bound to the agent, can't be switched per task || **Pi** | Inflection AI | ✅ (session is a file path) | ❌ | `.pi/skills/` | Dynamic discovery || **Qoder** | Alibaba | ✅ | ✅ | `.qoder/skills/` | Dynamic discovery |+| **Qwen Code** | Alibaba | ✅ (`--resume <id>`) | ✅ | `.qwen/skills/` | Runtime default or manual `--model` || **Trae** | ByteDance | ✅ (ACP `session/load`) | ✅ | `.traecli/skills/` | Dynamic discovery || **Grok** | xAI | ✅ (ACP `session/load`) | ✅ | `.grok/skills/` | Dynamic discovery (ACP `session/new`) |@@ -96,6 +97,10 @@ From Inflection AI, minimalist. **Session resumption is unusual** — the sessioFrom Alibaba. An agentic coding CLI. Uses the ACP protocol over stdio (shares a transport with Hermes, Kimi, and Kiro CLI). Session resumption works through ACP `session/resume`, MCP config is passed through ACP `mcpServers`, model selection is discovered dynamically, and skills are copied into `.qoder/skills/` for native discovery.+### Qwen Code++From Alibaba. Multica drives Qwen Code with its native non-interactive JSONL protocol, `qwen -p <prompt> --output-format stream-json`, and maps text, thinking, tool calls, tool results, session IDs, status, errors, and token usage into the normal task stream. **Session resumption works** through `--resume <id>`. The per-task runtime brief is written to `QWEN.md`; assigned skills are copied to `.qwen/skills/`; user skills are read from `$QWEN_HOME/skills/` (default `~/.qwen/skills/`). Select a default model with `MULTICA_QWEN_MODEL` or set a manual per-task value through Qwen's `--model` flag; Multica does not advertise an account-specific static catalog. A managed `mcp_config` is materialized into a 0600 temporary JSON file and passed as `--mcp-config <path>`, which Qwen gives highest precedence for that run; the file is removed when the process exits. Leave the field null to inherit native Qwen Code MCP settings.+### TraeFrom ByteDance — the official **TRAE CLI** (`traecli`, documented at [docs.trae.cn/cli](https://docs.trae.cn/cli); this is the product paired with the Trae IDE, **not** the open-source `bytedance/trae-agent`). traecli is ACP-native, so Multica drives it over the standard ACP JSON-RPC transport via `traecli acp serve --yolo`, exactly like Kiro and Qoder — `--yolo` puts it in bypass-permissions mode so headless runs don't block on tool-approval prompts.@@ -119,12 +124,12 @@ The session resumption mechanism is covered in [Tasks](/tasks#can-a-task-continu## MCP configuration: provider-specific support-**Of the 16 tools, twelve consume `mcp_config`: Claude Code, CodeBuddy, Codex, Cursor, Hermes, Kimi, Kiro CLI, OpenCode, OpenClaw, Qoder, Trae, and Grok**. The other four (Antigravity, Copilot, DevEco Code, Pi) accept the field but **ignore it** — no error, no warning, the config just has no effect.+**Of the 17 tools, thirteen consume `mcp_config`: Claude Code, CodeBuddy, Codex, Cursor, Hermes, Kimi, Kiro CLI, OpenCode, OpenClaw, Qoder, Qwen Code, Trae, and Grok**. The other four (Antigravity, Copilot, DevEco Code, Pi) accept the field but **ignore it** — no error, no warning, the config just has no effect.-The runtime paths are provider-specific: Claude Code and CodeBuddy receive it through `--mcp-config` paired with `--strict-mcp-config`; Codex writes a daemon-managed `mcp_servers` block into the per-task `$CODEX_HOME/config.toml`; Cursor writes `.cursor/mcp.json` plus per-task project approvals under `CURSOR_DATA_DIR`; Hermes, Kimi, Kiro CLI, Qoder, Trae, and Grok receive ACP `mcpServers`; OpenCode receives inline config through `OPENCODE_CONFIG_CONTENT`; OpenClaw receives `mcp.servers` through Multica's per-task config wrapper. OpenCode's path does **not** rewrite the project's `opencode.json`.+The runtime paths are provider-specific: Claude Code, CodeBuddy, and Qwen Code receive it through daemon-owned temporary JSON files passed with `--mcp-config` (mode `0600` on POSIX systems because MCP configs may embed API tokens); Claude Code and CodeBuddy additionally use `--strict-mcp-config`; Codex writes a daemon-managed `mcp_servers` block into the per-task `$CODEX_HOME/config.toml`; Cursor writes `.cursor/mcp.json` plus per-task project approvals under `CURSOR_DATA_DIR`; Hermes, Kimi, Kiro CLI, Qoder, Trae, and Grok receive ACP `mcpServers`; OpenCode receives inline config through `OPENCODE_CONFIG_CONTENT`; OpenClaw receives `mcp.servers` through Multica's per-task config wrapper. OpenCode's path does **not** rewrite the project's `opencode.json`.<Callout type="warning">-If you set `mcp_config` in an agent configuration but pick a tool not marked ✅ in the MCP column, your MCP servers have **no effect** on that agent. MCP integration is provider-specific.+If you set `mcp_config` in an agent configuration but pick a tool not marked ✅ in the MCP column, your MCP servers have no effect on Antigravity, Copilot, DevEco Code, or Pi.</Callout>## Where skill files go@@ -144,6 +149,7 @@ Each tool uses **its own** skill discovery path. Before a task runs, the Multica| DevEco Code | `.deveco/skills/` | ✅ Native || Pi | `.pi/skills/` | ✅ Native || Qoder | `.qoder/skills/` | ✅ Native |+| Qwen Code | `.qwen/skills/` | ✅ Native || Trae | `.traecli/skills/` | ✅ Native || Grok | `.grok/skills/` | ✅ Native || Antigravity | `.agents/skills/` | ✅ Native (inherits Gemini CLI's workspace layout — see [Antigravity docs](https://antigravity.google/docs/gcli-migration)) |@@ -161,4 +167,4 @@ For creating and using skills, see [Skills](/skills).- [Creating and configuring agents](/agents-create) — pick a tool for your agent- [Tasks](/tasks) — task lifecycle and session-resumption mechanics- [Daemon and runtimes](/daemon-runtimes) — where the tools run and how they connect to Multica-- [Install an agent runtime](/install-agent-runtime) — installation and authentication for each of the 16 supported tools+- [Install an agent runtime](/install-agent-runtime) — installation and authentication for each of the 17 supported toolsdiff --git a/packages/core/agents/mcp-support.test.ts b/packages/core/agents/mcp-support.test.tsindex f0cfea69cd..4f60297ea7 100644--- a/packages/core/agents/mcp-support.test.ts+++ b/packages/core/agents/mcp-support.test.ts@@ -14,6 +14,7 @@ describe("providerSupportsMcpConfig", () => {expect(providerSupportsMcpConfig("opencode")).toBe(true);expect(providerSupportsMcpConfig("openclaw")).toBe(true);expect(providerSupportsMcpConfig("qoder")).toBe(true);+ expect(providerSupportsMcpConfig("qwen")).toBe(true);expect(providerSupportsMcpConfig("traecli")).toBe(true);expect(providerSupportsMcpConfig("grok")).toBe(true);});diff --git a/packages/core/agents/mcp-support.ts b/packages/core/agents/mcp-support.tsindex 8df6a44963..4a9533173f 100644--- a/packages/core/agents/mcp-support.ts+++ b/packages/core/agents/mcp-support.ts@@ -17,6 +17,7 @@ const MCP_SUPPORTED_PROVIDERS = new Set(["opencode","openclaw","qoder",+ "qwen","traecli",]);diff --git a/packages/core/runtimes/display.test.ts b/packages/core/runtimes/display.test.tsindex b838270c9e..fa6e4ac4e7 100644--- a/packages/core/runtimes/display.test.ts+++ b/packages/core/runtimes/display.test.ts@@ -63,8 +63,8 @@ describe("runtimeDisplayLabel", () => {});it("uses the daemon's provider display name for overridden slugs", () => {- // Trae's slug is `traecli`; the label must read "Trae", matching the- // no-alias daemon name, not the title-cased slug "Traecli".+ // Trae and Qwen use display names that differ from title-cased slugs;+ // aliases must match the daemon's no-alias names.expect(runtimeDisplayLabel({name: "Trae (host)",@@ -72,12 +72,19 @@ describe("runtimeDisplayLabel", () => {provider: "traecli",}),).toBe("box (Trae)");+ expect(+ runtimeDisplayLabel({+ name: "Qwen Code (host)",+ custom_name: "box",+ provider: "qwen",+ }),+ ).toBe("box (Qwen Code)");});it("first-letter-capitalizes non-overridden slugs, matching the daemon", () => {- // The daemon only overrides `traecli`; every other provider is a- // first-letter capitalization on both the alias and no-alias paths, so the- // label must match to avoid drift (e.g. no-alias name is "Openclaw (host)").+ // Providers without an explicit daemon override are first-letter+ // capitalized on both the alias and no-alias paths, so the label must match+ // the daemon (e.g. no-alias name is "Openclaw (host)").expect(runtimeDisplayLabel({name: "Openclaw (host)",diff --git a/packages/core/runtimes/display.ts b/packages/core/runtimes/display.tsindex d2da2dc38f..166979d22d 100644--- a/packages/core/runtimes/display.ts+++ b/packages/core/runtimes/display.ts@@ -35,13 +35,14 @@ export function runtimeDisplayLabel(* Provider slugs whose human display name isn't just a capitalization of the* slug. This MUST mirror the daemon's `runtimeDisplayNameOverrides`* (server/internal/daemon/daemon.go): the daemon bakes that display name into- * `name` for the no-alias case ("Trae (host)"), so the aliased label has to use- * the exact same names or the two paths drift apart (#5260). Only `traecli`- * needs an override today — every other provider is a first-letter+ * `name` for the no-alias case (for example, "Trae (host)"), so the aliased label has to use+ * the exact same names or the two paths drift apart (#5260). `traecli` and `qwen`+ * need overrides today — every other provider is a first-letter* capitalization of its slug on both sides. Keep in sync with the daemon map.*/const PROVIDER_DISPLAY_NAMES: Record<string, string> = {traecli: "Trae",+ qwen: "Qwen Code",};/**diff --git a/packages/core/types/agent.ts b/packages/core/types/agent.tsindex fd28abb35f..10fc345ee4 100644--- a/packages/core/types/agent.ts+++ b/packages/core/types/agent.ts@@ -120,6 +120,7 @@ export const RUNTIME_PROFILE_PROTOCOL_FAMILIES = ["qoder","traecli","grok",+ "qwen",] as const;export type RuntimeProtocolFamily =diff --git a/packages/views/runtimes/components/provider-logo.test.tsx b/packages/views/runtimes/components/provider-logo.test.tsxnew file mode 100644index 0000000000..56fb26220e--- /dev/null+++ b/packages/views/runtimes/components/provider-logo.test.tsx@@ -0,0 +1,12 @@+import { render } from "@testing-library/react";+import { describe, expect, it } from "vitest";+import { ProviderLogo } from "./provider-logo";++describe("ProviderLogo", () => {+ it("renders the dedicated Qwen Code mark", () => {+ const { container } = render(<ProviderLogo provider="qwen" className="runtime-logo" />);++ expect(container.querySelector("#qwen-logo-gradient")).not.toBeNull();+ expect(container.querySelector("svg")?.classList.contains("runtime-logo")).toBe(true);+ });+});diff --git a/packages/views/runtimes/components/provider-logo.tsx b/packages/views/runtimes/components/provider-logo.tsxindex 582b0bd334..a9b19f21e9 100644--- a/packages/views/runtimes/components/provider-logo.tsx+++ b/packages/views/runtimes/components/provider-logo.tsx@@ -283,6 +283,24 @@ function GrokLogo({ className }: { className: string }) {);}+// Qwen Code — compact Q mark using Qwen's violet/blue brand palette. The+// inline SVG keeps the runtime list crisp at small sizes without another asset.+function QwenLogo({ className }: { className: string }) {+ return (+ <svg viewBox="0 0 24 24" fill="none" className={className} aria-hidden>+ <defs>+ <linearGradient id="qwen-logo-gradient" x1="4" y1="3" x2="20" y2="21">+ <stop stopColor="#7C4DFF" />+ <stop offset="1" stopColor="#2F80ED" />+ </linearGradient>+ </defs>+ <rect width="24" height="24" rx="5" fill="url(#qwen-logo-gradient)" />+ <circle cx="11.5" cy="11.5" r="5.25" stroke="white" strokeWidth="2.25" />+ <path d="m15.2 15.2 3.1 3.1" stroke="white" strokeWidth="2.25" strokeLinecap="round" />+ </svg>+ );+}+export function ProviderLogo({provider,className = "h-4 w-4",@@ -323,6 +341,8 @@ export function ProviderLogo({return <TraeLogo className={className} />;case "grok":return <GrokLogo className={className} />;+ case "qwen":+ return <QwenLogo className={className} />;default:return <Monitor className={className} />;}diff --git a/server/internal/daemon/config.go b/server/internal/daemon/config.goindex 1a05881ecf..acc7fbdfc0 100644--- a/server/internal/daemon/config.go+++ b/server/internal/daemon/config.go@@ -91,7 +91,7 @@ type Config struct {CLIVersion string // multica CLI version (e.g. "0.1.13")LaunchedBy string // "desktop" when spawned by the Electron app, empty for standaloneProfile string // profile name (empty = default)- Agents map[string]AgentEntry // keyed by provider: claude, codebuddy, codex, copilot, opencode, openclaw, hermes, pi, cursor, kimi, kiro, antigravity, qoder, traecli, grok+ Agents map[string]AgentEntry // keyed by provider: claude, codebuddy, codex, copilot, opencode, openclaw, hermes, pi, cursor, kimi, kiro, antigravity, qoder, traecli, grok, qwenWorkspacesRoot string // base path for execution envs (default: ~/multica_workspaces)KeepEnvAfterTask bool // preserve env after task for debuggingHealthPort int // local HTTP port for health checks (default: 19514)@@ -116,6 +116,7 @@ type Config struct {ClaudeArgs []stringCodexArgs []stringCodebuddyArgs []string+ QwenArgs []string// ProfileCommandOverrides maps a custom runtime profile_id -> the absolute// executable path to use for that profile on THIS machine (MUL-3284).@@ -339,8 +340,13 @@ func LoadConfig(overrides Overrides) (Config, error) {if e, ok := probe("MULTICA_GROK_PATH", "grok", "MULTICA_GROK_MODEL"); ok {agents["grok"] = e}+ // Qwen Code (`qwen`) runs headlessly with -p and stream-json. Its native+ // QWEN.md and .qwen/skills task context is prepared by execenv.+ if e, ok := probe("MULTICA_QWEN_PATH", "qwen", "MULTICA_QWEN_MODEL"); ok {+ agents["qwen"] = e+ }if len(agents) == 0 {- return Config{}, fmt.Errorf("no agent CLI found: install claude, codebuddy, codex, copilot, opencode, deveco, openclaw, hermes, pi, cursor-agent, kimi, kiro-cli, agy, qodercli, traecli, or grok and ensure it is on PATH")+ return Config{}, fmt.Errorf("no agent CLI found: install claude, codebuddy, codex, copilot, opencode, deveco, openclaw, hermes, pi, cursor-agent, kimi, kiro-cli, agy, qodercli, traecli, grok, or qwen and ensure it is on PATH")}claudeArgs, err := shellArgsFromEnv("MULTICA_CLAUDE_ARGS")@@ -355,6 +361,10 @@ func LoadConfig(overrides Overrides) (Config, error) {if err != nil {return Config{}, err}+ qwenArgs, err := shellArgsFromEnv("MULTICA_QWEN_ARGS")+ if err != nil {+ return Config{}, err+ }// Host infohost, err := os.Hostname()@@ -589,6 +599,7 @@ func LoadConfig(overrides Overrides) (Config, error) {ClaudeArgs: claudeArgs,CodexArgs: codexArgs,CodebuddyArgs: codebuddyArgs,+ QwenArgs: qwenArgs,ProfileCommandOverrides: profileCommandOverrides,}, nil}@@ -849,7 +860,7 @@ func isExecutableFile(path string) bool {// invocation, instead of paying the cost-per-miss.var defaultAgentCommandNames = []string{"claude", "codex", "opencode", "deveco", "openclaw", "hermes",- "pi", "cursor-agent", "copilot", "kimi", "kiro-cli", "codebuddy", "agy", "traecli", "grok",+ "pi", "cursor-agent", "copilot", "kimi", "kiro-cli", "codebuddy", "agy", "traecli", "grok", "qwen",}// codexDesktopAppBundlePaths returns candidate macOS app-bundle locations fordiff --git a/server/internal/daemon/config_test.go b/server/internal/daemon/config_test.goindex c006dd85ce..e97eecc1c0 100644--- a/server/internal/daemon/config_test.go+++ b/server/internal/daemon/config_test.go@@ -249,6 +249,44 @@ func stageFakeAgent(t *testing.T) string {return binDir}+func TestLoadConfig_DiscoversQwenCode(t *testing.T) {+ if runtime.GOOS == "windows" {+ t.Skip("POSIX shell fixture is unavailable on Windows")+ }+ binDir := stageFakeAgent(t)+ qwen := filepath.Join(binDir, "qwen")+ if err := os.WriteFile(qwen, []byte("#!/bin/sh\nexit 0\n"), 0o755); err != nil {+ t.Fatalf("write fake qwen: %v", err)+ }+ // Avoid consulting an inherited interactive shell for all deliberately+ // absent providers; this test is about ordinary PATH discovery.+ t.Setenv("SHELL", "/usr/bin/fish")+ t.Setenv("MULTICA_QWEN_MODEL", "qwen3.8-max-preview")+ t.Setenv("MULTICA_QWEN_ARGS", "--verbose --foo=bar")++ cfg, err := LoadConfig(Overrides{+ ServerURL: "http://localhost:0",+ WorkspacesRoot: t.TempDir(),+ })+ if err != nil {+ t.Fatalf("LoadConfig: %v", err)+ }+ entry, ok := cfg.Agents["qwen"]+ if !ok {+ t.Fatalf("qwen was not discovered: %v", cfg.Agents)+ }+ wantPath, err := filepath.EvalSymlinks(qwen)+ if err != nil {+ t.Fatalf("eval symlinks for qwen: %v", err)+ }+ if entry.Path != wantPath || entry.Command != "qwen" || entry.Model != "qwen3.8-max-preview" {+ t.Fatalf("qwen entry = %+v, want path=%q command=qwen model=qwen3.8-max-preview", entry, wantPath)+ }+ if got, want := strings.Join(cfg.QwenArgs, " "), "--verbose --foo=bar"; got != want {+ t.Fatalf("QwenArgs = %q, want %q", got, want)+ }+}+func TestLoadConfig_SkipsMulticaHooksShadowingAgentBinaries(t *testing.T) {if runtime.GOOS == "windows" {t.Skip("POSIX shell not available on Windows")diff --git a/server/internal/daemon/daemon.go b/server/internal/daemon/daemon.goindex 49abfe1492..de91c89f2f 100644--- a/server/internal/daemon/daemon.go+++ b/server/internal/daemon/daemon.go@@ -3617,6 +3617,7 @@ func gcMetaForTask(task Task) (execenv.GCMeta, bool) {var runtimeDisplayNameOverrides = map[string]string{"traecli": "Trae","grok": "Grok",+ "qwen": "Qwen Code",}// providerDisplayName returns the human-facing runtime name for a provider key.@@ -5636,6 +5637,8 @@ func defaultArgsForProvider(cfg Config, provider string) []string {args = cfg.CodexArgscase "codebuddy":args = cfg.CodebuddyArgs+ case "qwen":+ args = cfg.QwenArgsdefault:return nil}diff --git a/server/internal/daemon/daemon_test.go b/server/internal/daemon/daemon_test.goindex 41f8e7380a..5a46831727 100644--- a/server/internal/daemon/daemon_test.go+++ b/server/internal/daemon/daemon_test.go@@ -514,6 +514,8 @@ func TestProviderNeedsInlineSystemPrompt(t *testing.T) {{provider: "kiro", want: false},{provider: "kimi", want: true},{provider: "traecli", want: true},+ // Qwen Code loads the per-task QWEN.md file natively.+ {provider: "qwen", want: false},{provider: "codex", want: false},{provider: "claude", want: false},}diff --git a/server/internal/daemon/execenv/context.go b/server/internal/daemon/execenv/context.goindex 208d2a203d..b012014d03 100644--- a/server/internal/daemon/execenv/context.go+++ b/server/internal/daemon/execenv/context.go@@ -131,6 +131,7 @@ func writeWorkspacesRootMarkerAtomic(path string, data []byte) error {// Kimi: skills → {workDir}/.kimi/skills/{name}/SKILL.md (native discovery)// Kiro: skills → {workDir}/.kiro/skills/{name}/SKILL.md (native discovery)// Qoder: skills → {workDir}/.qoder/skills/{name}/SKILL.md (project-level; see docs.qoder.com/cli/Skills.md)+// Qwen Code: skills → {workDir}/.qwen/skills/{name}/SKILL.md (native project-level discovery)// Antigravity: skills → {workDir}/.agents/skills/{name}/SKILL.md (native discovery — see https://antigravity.google/docs/gcli-migration "Workspace skills")// Default: skills → {workDir}/.agent_context/skills/{name}/SKILL.md//@@ -388,6 +389,9 @@ func skillsDirPath(workDir, provider string) string {// Qoder CLI discovers project-level skills under .qoder/skills/.// See https://docs.qoder.com/cli/Skills.mdreturn filepath.Join(workDir, ".qoder", "skills")+ case "qwen":+ // Qwen Code discovers project-level skills from .qwen/skills/ in the workdir.+ return filepath.Join(workDir, ".qwen", "skills")case "traecli":// Official TRAE CLI discovers project-level skills from .traecli/skills/// in the workdir (global skills live in ~/.traecli/skills). Seediff --git a/server/internal/daemon/execenv/execenv_test.go b/server/internal/daemon/execenv/execenv_test.goindex abf5a555ab..d82b5ad763 100644--- a/server/internal/daemon/execenv/execenv_test.go+++ b/server/internal/daemon/execenv/execenv_test.go@@ -745,7 +745,7 @@ func TestReuseReclaimsManagedSkillDirWithStrayAgentFile(t *testing.T) {func TestReuseSkillRefreshIsCanonicalAcrossProviders(t *testing.T) {t.Parallel()- for _, provider := range []string{"claude", "codebuddy", "openclaw", "copilot", ""} {+ for _, provider := range []string{"claude", "codebuddy", "openclaw", "copilot", "qwen", ""} {provider := providername := providerif name == "" {@@ -1354,6 +1354,33 @@ func TestWriteContextFilesQoderNativeSkills(t *testing.T) {}}+func TestWriteContextFilesQwenNativeSkills(t *testing.T) {+ t.Parallel()+ dir := t.TempDir()++ ctx := TaskContextForEnv{+ IssueID: "qwen-skill-test",+ AgentSkills: []SkillContextForEnv{+ {Name: "Go Conventions", Content: "Follow Go conventions."},+ },+ }++ if err := writeContextFiles(dir, "qwen", ctx, nil); err != nil {+ t.Fatalf("writeContextFiles failed: %v", err)+ }++ skillMd, err := os.ReadFile(filepath.Join(dir, ".qwen", "skills", "go-conventions", "SKILL.md"))+ if err != nil {+ t.Fatalf("failed to read .qwen/skills/go-conventions/SKILL.md: %v", err)+ }+ if !strings.Contains(string(skillMd), "Follow Go conventions.") {+ t.Error("SKILL.md missing content")+ }+ if _, err := os.Stat(filepath.Join(dir, ".agent_context", "skills")); !os.IsNotExist(err) {+ t.Error("expected .agent_context/skills/ to NOT exist for Qwen provider")+ }+}+func TestInjectRuntimeConfigOpencode(t *testing.T) {t.Parallel()dir := t.TempDir()diff --git a/server/internal/daemon/execenv/runtime_config.go b/server/internal/daemon/execenv/runtime_config.goindex 5004cf5ff2..09b82f7c44 100644--- a/server/internal/daemon/execenv/runtime_config.go+++ b/server/internal/daemon/execenv/runtime_config.go@@ -172,6 +172,7 @@ func formatProjectResource(r ProjectResourceForEnv) string {// For Antigravity: writes {workDir}/AGENTS.md (agy CLI reads AGENTS.md natively; skills discovered natively from .agents/skills/ — see https://antigravity.google/docs/gcli-migration)// For Traecli: writes {workDir}/AGENTS.md (traecli reads .trae/rules/ not AGENTS.md, so the brief is delivered inline via providerNeedsInlineSystemPrompt; the file is written for parity/visibility only)// For Grok: writes {workDir}/AGENTS.md (Grok Build CLI reads AGENTS.md natively from the workdir)+// For Qwen: writes {workDir}/QWEN.md (Qwen Code's native context file; it also reads AGENTS.md, but QWEN.md avoids cross-runtime ambiguity)func InjectRuntimeConfig(workDir, provider string, ctx TaskContextForEnv) (string, error) {content := buildMetaSkillContent(provider, ctx)path := runtimeConfigPath(workDir, provider)@@ -198,6 +199,8 @@ func runtimeConfigPath(workDir, provider string) string {// file"). CodeBuddy only reads CLAUDE.md if the user manually// migrates/symlinks it in.return filepath.Join(workDir, "CODEBUDDY.md")+ case "qwen":+ return filepath.Join(workDir, "QWEN.md")case "codex", "copilot", "opencode", "deveco", "openclaw", "hermes", "pi", "cursor", "kimi", "kiro", "antigravity", "qoder", "traecli", "grok":return filepath.Join(workDir, "AGENTS.md")default:diff --git a/server/internal/daemon/execenv/runtime_config_sections.go b/server/internal/daemon/execenv/runtime_config_sections.goindex 643a57a985..68a131de86 100644--- a/server/internal/daemon/execenv/runtime_config_sections.go+++ b/server/internal/daemon/execenv/runtime_config_sections.go@@ -440,7 +440,7 @@ func writeSkills(b *strings.Builder, provider string, ctx TaskContextForEnv) {}b.WriteString("## Skills\n\n")switch provider {- case "claude", "codebuddy", "codex", "copilot", "opencode", "deveco", "openclaw", "hermes", "pi", "cursor", "kimi", "kiro", "qoder", "antigravity":+ case "claude", "codebuddy", "codex", "copilot", "opencode", "deveco", "openclaw", "hermes", "pi", "cursor", "kimi", "kiro", "qoder", "antigravity", "qwen":// Hermes discovers these from its per-task HERMES_HOME/skills (seeded by// the daemon), so it needs the same "discovered automatically" framing// as the other native-discovery runtimes rather than a path pointer.diff --git a/server/internal/daemon/execenv/runtime_config_test.go b/server/internal/daemon/execenv/runtime_config_test.goindex 4d66d47636..0e3a9e2dca 100644--- a/server/internal/daemon/execenv/runtime_config_test.go+++ b/server/internal/daemon/execenv/runtime_config_test.go@@ -813,6 +813,7 @@ func TestInjectRuntimeConfigPreservesUserContent(t *testing.T) {{"kimi", "AGENTS.md"},{"kiro", "AGENTS.md"},{"antigravity", "AGENTS.md"},+ {"qwen", "QWEN.md"},}for _, tc := range cases {tc := tc@@ -1186,6 +1187,7 @@ func TestCleanupRuntimeConfigByProvider(t *testing.T) {{"kimi", "AGENTS.md"},{"kiro", "AGENTS.md"},{"antigravity", "AGENTS.md"},+ {"qwen", "QWEN.md"},}for _, tc := range cases {tc := tcdiff --git a/server/internal/daemon/execenv/sidecar_manifest_test.go b/server/internal/daemon/execenv/sidecar_manifest_test.goindex 3d43c09801..4f57764263 100644--- a/server/internal/daemon/execenv/sidecar_manifest_test.go+++ b/server/internal/daemon/execenv/sidecar_manifest_test.go@@ -155,6 +155,7 @@ var allFileBasedProviders = []string{"kimi","kiro","antigravity",+ "qwen",}// TestPrepareThenCleanupSidecarsRoundTripEmptyWorkdir is the headline@@ -233,6 +234,7 @@ func TestPrepareThenCleanupSidecarsPreservesUserSkillSibling(t *testing.T) {{"kimi", filepath.Join(".kimi", "skills", "my-own"), "SKILL.md"},{"kiro", filepath.Join(".kiro", "skills", "my-own"), "SKILL.md"},{"antigravity", filepath.Join(".agents", "skills", "my-own"), "SKILL.md"},+ {"qwen", filepath.Join(".qwen", "skills", "my-own"), "SKILL.md"},{"hermes", filepath.Join(".agent_context", "skills", "my-own"), "SKILL.md"},}for _, tc := range cases {@@ -297,6 +299,7 @@ func TestPrepareThenCleanupSidecarsPreservesUnrelatedUserFiles(t *testing.T) {{"kimi", filepath.Join(".kimi", "config.json")},{"kiro", filepath.Join(".kiro", "config.json")},{"antigravity", filepath.Join(".agents", "config.json")},+ {"qwen", filepath.Join(".qwen", "settings.json")},}for _, tc := range cases {tc := tc@@ -625,6 +628,7 @@ var sameSlugSkillProviderCases = []struct {{"kimi", filepath.Join(".kimi", "skills", "issue-review")},{"kiro", filepath.Join(".kiro", "skills", "issue-review")},{"antigravity", filepath.Join(".agents", "skills", "issue-review")},+ {"qwen", filepath.Join(".qwen", "skills", "issue-review")},{"hermes", filepath.Join(".agent_context", "skills", "issue-review")},}diff --git a/server/internal/daemon/local_skills.go b/server/internal/daemon/local_skills.goindex 577497e288..a1d6adec60 100644--- a/server/internal/daemon/local_skills.go+++ b/server/internal/daemon/local_skills.go@@ -105,6 +105,7 @@ const (// - Antigravity: ~/.gemini/antigravity-cli/skills user-level skill root// (https://antigravity.google/docs/gcli-migration "Global skills")// - Grok: $GROK_HOME/skills, defaulting to ~/.grok/skills+// - Qwen Code: $QWEN_HOME/skills, defaulting to ~/.qwen/skills//// The universal ~/.agents/skills root is documented as a cross-tool skill// location by Codex (https://developers.openai.com/codex/skills) and Gemini@@ -175,6 +176,15 @@ func localSkillRootsForProvider(provider string) ([]localSkillRoot, bool, error)grokHome = filepath.Join(home, ".grok")}providerRoot = filepath.Join(grokHome, "skills")+ case "qwen":+ // QWEN_HOME replaces Qwen Code's global ~/.qwen directory. It owns+ // settings, sessions, credentials and personal skills; project+ // .qwen/skills remains rooted in the task workdir.+ qwenHome := strings.TrimSpace(os.Getenv("QWEN_HOME"))+ if qwenHome == "" {+ qwenHome = filepath.Join(home, ".qwen")+ }+ providerRoot = filepath.Join(qwenHome, "skills")default:return nil, false, nil}diff --git a/server/internal/daemon/local_skills_test.go b/server/internal/daemon/local_skills_test.goindex f3b3084df0..a9ba7fb411 100644--- a/server/internal/daemon/local_skills_test.go+++ b/server/internal/daemon/local_skills_test.go@@ -278,6 +278,12 @@ func TestLocalSkills_DiscoversACPProviderRoots(t *testing.T) {wantPath: "~/.qoder/skills/review-helper",wantName: "Qoder Review",},+ {+ provider: "qwen",+ root: filepath.Join(".qwen", "skills"),+ wantPath: "~/.qwen/skills/review-helper",+ wantName: "Qwen Review",+ },{provider: "grok",root: filepath.Join(".grok", "skills"),@@ -293,6 +299,9 @@ func TestLocalSkills_DiscoversACPProviderRoots(t *testing.T) {if tc.provider == "grok" {t.Setenv("GROK_HOME", "")}+ if tc.provider == "qwen" {+ t.Setenv("QWEN_HOME", "")+ }writeTestLocalSkill(t, filepath.Join(home, tc.root), "review-helper", map[string]string{"SKILL.md": "---\nname: " + tc.wantName + "\ndescription: Review code\n---\n# Review\n",@@ -377,6 +386,41 @@ func TestListRuntimeLocalSkills_GrokUsesGROKHOME(t *testing.T) {}}+func TestListRuntimeLocalSkills_QwenUsesQWENHOME(t *testing.T) {+ home := t.TempDir()+ qwenHome := filepath.Join(t.TempDir(), "custom-qwen-home")+ t.Setenv("HOME", home)+ t.Setenv("QWEN_HOME", qwenHome)+ writeTestLocalSkill(t, filepath.Join(qwenHome, "skills"), "review-helper", map[string]string{+ "SKILL.md": "---\nname: Qwen Home Review\ndescription: Review code\n---\n# Review\n",+ })+ writeTestLocalSkill(t, filepath.Join(home, ".qwen", "skills"), "wrong-home", map[string]string{+ "SKILL.md": "---\nname: Wrong Home\n---\n# Wrong\n",+ })++ skills, supported, err := listRuntimeLocalSkills("qwen")+ if err != nil {+ t.Fatalf("listRuntimeLocalSkills: %v", err)+ }+ if !supported {+ t.Fatal("qwen should be supported")+ }+ if len(skills) != 1 || skills[0].Key != "review-helper" {+ t.Fatalf("expected only QWEN_HOME skill, got %+v", skills)+ }+ if skills[0].SourcePath != filepath.ToSlash(filepath.Join(qwenHome, "skills", "review-helper")) {+ t.Fatalf("source_path = %q, want custom QWEN_HOME path", skills[0].SourcePath)+ }++ bundle, supported, err := loadRuntimeLocalSkillBundle("qwen", "review-helper")+ if err != nil {+ t.Fatalf("loadRuntimeLocalSkillBundle: %v", err)+ }+ if !supported || bundle == nil || bundle.Name != "Qwen Home Review" {+ t.Fatalf("unexpected bundle: supported=%v bundle=%+v", supported, bundle)+ }+}+// Skill installers (for example lark-cli) place every skill at a shared// location like ~/.agents/skills/<name> and symlink each one into the// runtime root (~/.claude/skills/<name>). The previous filepath.WalkDir@@ -1004,4 +1048,5 @@ func TestLoadRuntimeLocalSkillBundle_ProviderNonDirFallsThrough(t *testing.T) {if bundle.Name != "Filish" || bundle.SourcePath != "~/.agents/skills/filish" {t.Fatalf("bundle = %+v, want universal Filish", bundle)}+}diff --git a/server/internal/daemon/runtime_profile_test.go b/server/internal/daemon/runtime_profile_test.goindex d09d6b339e..4094d3227d 100644--- a/server/internal/daemon/runtime_profile_test.go+++ b/server/internal/daemon/runtime_profile_test.go@@ -153,6 +153,30 @@ func newProfileRegisterFixture(t *testing.T, profiles []RuntimeProfile, profiles// profile_id, and that its resolved command path is recorded for runTask.// Uses a custom-only host (no built-in agents) to also prove that path still// registers.+func TestRegisterRuntimes_IncludesBuiltInQwen(t *testing.T) {+ t.Cleanup(stubAgentVersion(t))+ fx := newProfileRegisterFixture(t, nil, http.StatusOK)+ d := fx.daemon+ d.cfg.Agents = map[string]AgentEntry{+ "qwen": {Path: "/usr/bin/true", Command: "qwen", Model: "qwen3.8-max-preview"},+ }++ resp, _, err := d.registerRuntimesForWorkspace(context.Background(), "ws-1")+ if err != nil {+ t.Fatalf("registerRuntimesForWorkspace: %v", err)+ }+ if len(fx.sentRuntimes) != 1 {+ t.Fatalf("sent runtimes = %d, want 1: %+v", len(fx.sentRuntimes), fx.sentRuntimes)+ }+ sent := fx.sentRuntimes[0]+ if sent["type"] != "qwen" || sent["name"] != "Qwen Code" || sent["version"] != "9.9.9" || sent["status"] != "online" {+ t.Fatalf("registered Qwen runtime = %+v", sent)+ }+ if len(resp.Runtimes) != 1 || resp.Runtimes[0].Provider != "qwen" {+ t.Fatalf("register response = %+v", resp)+ }+}+func TestRegisterRuntimes_AppendsProfileRuntime(t *testing.T) {t.Cleanup(stubAgentVersion(t))stubLookPath(t, map[string]string{"company-codex": "/opt/bin/company-codex"})diff --git a/server/internal/metrics/labels.go b/server/internal/metrics/labels.goindex 4bfa055c31..b730ed6cf0 100644--- a/server/internal/metrics/labels.go+++ b/server/internal/metrics/labels.go@@ -131,6 +131,7 @@ var ("opencode": "opencode","deveco": "deveco","pi": "pi",+ "qwen": "qwen","other": "other",}knownTerminalStatuses = map[string]string{diff --git a/server/internal/metrics/labels_test.go b/server/internal/metrics/labels_test.goindex 141927a597..120b9842f2 100644--- a/server/internal/metrics/labels_test.go+++ b/server/internal/metrics/labels_test.go@@ -12,6 +12,12 @@ func TestBusinessMetricLabelsRejectHighCardinalityNames(t *testing.T) {}}+func TestNormalizeRuntimeProviderRecognizesQwen(t *testing.T) {+ if got := NormalizeRuntimeProvider("QWEN"); got != "qwen" {+ t.Fatalf("NormalizeRuntimeProvider(QWEN) = %q, want qwen", got)+ }+}+func TestNormalizeLabelsCollapseUnknownValues(t *testing.T) {if got := NormalizeRuntimeProvider("provider-from-user-input"); got != "other" {t.Fatalf("NormalizeRuntimeProvider unknown = %q, want other", got)diff --git a/server/internal/service/builtin_skills/multica-creating-agents/SKILL.md b/server/internal/service/builtin_skills/multica-creating-agents/SKILL.mdindex de5c230a26..0101226125 100644--- a/server/internal/service/builtin_skills/multica-creating-agents/SKILL.md+++ b/server/internal/service/builtin_skills/multica-creating-agents/SKILL.md@@ -78,7 +78,7 @@ The HTTP body (`CreateAgentRequest`) accepts: `name`, `description`,| `custom_args` | `agent.custom_args` (JSON array) | JSON shape checked CLI-side; server stores as-is | daemon (extra CLI switches); defaults to `[]` || `runtime_config` | `agent.runtime_config` (JSON) | JSON shape checked CLI-side; server stores as-is | runtime-specific config; defaults to `{}` || `custom_env` | `agent.custom_env` (JSON object) | — | daemon (process env); see Env & secrets |-| `mcp_config` | `agent.mcp_config` (raw JSON) | CLI checks it is a JSON object or `null`; server stores as-is. At create, literal `null` is dropped (no-op); at update, `null` clears the column | daemon → provider (MCP servers) — **runtime-consumed**; redacted on read |+| `mcp_config` | `agent.mcp_config` (raw JSON) | CLI checks it is a JSON object or `null`; server stores as-is. At create, literal `null` is dropped (no-op); at update, `null` clears the column | daemon → provider (provider-specific MCP handling); redacted on read || `visibility` | `agent.visibility` | — | access control; defaults to `private`; gates who can read/route a private agent (e.g. a private squad leader) — NOT the runtime prompt || `max_concurrent_tasks` | `agent.max_concurrent_tasks` | — | scheduler task cap; defaults to `6` |@@ -172,6 +172,8 @@ Two ways `mcp_config` differs from `custom_env`:field is `null` and `mcp_config_redacted` is `true`. Agent actors never seeit, and a workspace may force redaction for everyone.+Provider support is not uniform: Qwen Code accepts a managed `mcp_config` through a daemon-owned 0600 temporary JSON file passed with `--mcp-config`; it is removed when the run exits. Leave the field unset (`null`) to inherit Qwen Code native settings.+## Skill bindingCreating an agent does NOT bind any workspace skill — binding is a separatediff --git a/server/internal/service/builtin_skills/multica-creating-agents/references/creating-agents-source-map.md b/server/internal/service/builtin_skills/multica-creating-agents/references/creating-agents-source-map.mdindex 2549578067..9f493f849f 100644--- a/server/internal/service/builtin_skills/multica-creating-agents/references/creating-agents-source-map.md+++ b/server/internal/service/builtin_skills/multica-creating-agents/references/creating-agents-source-map.md@@ -61,6 +61,7 @@ only.| `max_concurrent_tasks` default | 638–639 | `if req.MaxConcurrentTasks == 0 { req.MaxConcurrentTasks = 6 }` — scheduler cap || `mcp_config` null-skip on create | 704–705 | raw JSON copied through unless the body value is the literal `null` || `mcp_config` redacted on read | 54, 848–851 | `redactMcpConfig` sets `McpConfigRedacted=true`; a private agent read by a member also redacts (494, 509) |+| Qwen Code managed-MCP injection | `pkg/agent/qwen.go` | Non-null `mcp_config` is written to a daemon-owned 0600 temporary JSON file and passed with `--mcp-config`; the file is removed after the process exits, while `null` preserves native inheritance. || `CreateAgent` insert params | 708–722 | persists runtime_config, instructions, custom_env, custom_args, model, thinking_level, mcp_config, visibility, max_concurrent_tasks || `UpdateAgent` rejects `custom_env` | 910–913 | if `custom_env` present in body → 400 "use PUT /api/agents/{id}/env (or `multica agent env set`)" || `UpdateAgent` persists / clears `mcp_config` | 944–948, 1060–1061 | Tri-state from the raw body: key omitted → no change; literal `null` → `ClearAgentMcpConfig`; object → replace. No 400 like `custom_env` — `mcp_config` IS updatable here |diff --git a/server/migrations/202_runtime_profile_add_qwen.down.sql b/server/migrations/202_runtime_profile_add_qwen.down.sqlnew file mode 100644index 0000000000..ce15320193--- /dev/null+++ b/server/migrations/202_runtime_profile_add_qwen.down.sql@@ -0,0 +1,23 @@+-- Restore the pre-202 whitelist (with Grok, without Qwen Code). NOT VALID+-- keeps rollback compatible with historical rows the prior migrations allowed.+ALTER TABLE runtime_profile DROP CONSTRAINT IF EXISTS runtime_profile_protocol_family_check;++ALTER TABLE runtime_profile ADD CONSTRAINT runtime_profile_protocol_family_check+ CHECK (protocol_family IN (+ 'claude',+ 'codebuddy',+ 'codex',+ 'copilot',+ 'opencode',+ 'openclaw',+ 'hermes',+ 'pi',+ 'cursor',+ 'kimi',+ 'kiro',+ 'antigravity',+ 'qoder',+ 'traecli',+ 'deveco',+ 'grok'+ )) NOT VALID;diff --git a/server/migrations/202_runtime_profile_add_qwen.up.sql b/server/migrations/202_runtime_profile_add_qwen.up.sqlnew file mode 100644index 0000000000..9ed9369785--- /dev/null+++ b/server/migrations/202_runtime_profile_add_qwen.up.sql@@ -0,0 +1,25 @@+-- Add Qwen Code (`qwen`) to the built-in runtime profile protocol whitelist.+-- Kept in lockstep with agent.SupportedTypes and agent.New(). NOT VALID+-- preserves the historical-row tolerance used by the prior family additions.+ALTER TABLE runtime_profile DROP CONSTRAINT IF EXISTS runtime_profile_protocol_family_check;++ALTER TABLE runtime_profile ADD CONSTRAINT runtime_profile_protocol_family_check+ CHECK (protocol_family IN (+ 'claude',+ 'codebuddy',+ 'codex',+ 'copilot',+ 'opencode',+ 'openclaw',+ 'hermes',+ 'pi',+ 'cursor',+ 'kimi',+ 'kiro',+ 'antigravity',+ 'qoder',+ 'traecli',+ 'deveco',+ 'grok',+ 'qwen'+ )) NOT VALID;diff --git a/server/pkg/agent/agent.go b/server/pkg/agent/agent.goindex deb944f616..ac9f932273 100644--- a/server/pkg/agent/agent.go+++ b/server/pkg/agent/agent.go@@ -1,6 +1,7 @@// Package agent provides a unified interface for executing prompts via// coding agents (Claude Code, CodeBuddy, Codex, Copilot, OpenCode, DevEco Code,-// OpenClaw, Hermes, Pi, Cursor, Kimi, Kiro, Antigravity, Qoder, Trae, Grok). It+// OpenClaw, Hermes, Pi, Cursor, Kimi, Kiro, Antigravity, Qoder, Trae, Grok,+// Qwen Code). It// mirrors the happy-cli AgentBackend pattern, translated to idiomatic Go.package agent@@ -150,7 +151,7 @@ type Result struct {// Config configures a Backend instance.type Config struct {- ExecutablePath string // path to CLI binary (claude, codebuddy, codex, copilot, opencode, openclaw, hermes, pi, cursor, kimi, kiro-cli, agy, qodercli, traecli, grok)+ ExecutablePath string // path to CLI binary (claude, codebuddy, codex, copilot, opencode, openclaw, hermes, pi, cursor, kimi, kiro-cli, agy, qodercli, traecli, grok, qwen)CLIVersion string // detected version paired with ExecutablePath; observation only, never used to choose behaviorEnv map[string]string // extra environment variablesLogger *slog.Logger@@ -161,20 +162,22 @@ type Config struct {}// New creates a Backend for the given agent type.-// Supported types: "claude", "codebuddy", "codex", "copilot", "opencode", "deveco", "openclaw", "hermes", "pi", "cursor", "kimi", "kiro", "antigravity", "qoder", "traecli", "grok".+// Supported types: "claude", "codebuddy", "codex", "copilot", "opencode", "deveco", "openclaw", "hermes", "pi", "cursor", "kimi", "kiro", "antigravity", "qoder", "traecli", "grok", "qwen".//// SupportedTypes is the canonical whitelist of agent types eligible to back a// custom runtime profile. It MUST stay in lockstep with the// runtime_profile.protocol_family CHECK constraint (migration 120, widened by// migration 134 to add qoder, migration 136 to add traecli, migration 175 to-// add deveco, and migration 179 to add grok): a custom runtime profile may only+// add deveco, migration 179 to add grok, and migration 202 to add qwen): a+// custom runtime profile may only// be based on a backend Multica officially supports.// qoder is exposed here so Qoder CN (`qoderclicn`) users can point the Qoder// backend at a non-default binary instead of misrouting through Kiro/ACP with// incompatible arguments (#4883). traecli (Trae) has a New backend, launch// header and provider branding but was previously missing from this whitelist,// so the family picker rejected it (#4945). grok is the xAI Grok Build CLI-// ACP backend (`grok agent --always-approve stdio`).+// ACP backend (`grok agent --always-approve stdio`). qwen is Qwen Code's+// native `qwen -p <prompt> --output-format stream-json` backend.var SupportedTypes = []string{"claude","codebuddy",@@ -192,6 +195,7 @@ var SupportedTypes = []string{"qoder","traecli","grok",+ "qwen",}// IsSupportedType reports whether agentType is in the SupportedTypes whitelist.@@ -244,8 +248,10 @@ func New(agentType string, cfg Config) (Backend, error) {return &traecliBackend{cfg: cfg}, nilcase "grok":return &grokBackend{cfg: cfg}, nil+ case "qwen":+ return &qwenBackend{cfg: cfg}, nildefault:- return nil, fmt.Errorf("unknown agent type: %q (supported: claude, codebuddy, codex, copilot, opencode, deveco, openclaw, hermes, pi, cursor, kimi, kiro, antigravity, qoder, traecli, grok)", agentType)+ return nil, fmt.Errorf("unknown agent type: %q (supported: claude, codebuddy, codex, copilot, opencode, deveco, openclaw, hermes, pi, cursor, kimi, kiro, antigravity, qoder, traecli, grok, qwen)", agentType)}}@@ -277,6 +283,7 @@ var launchHeaders = map[string]string{"qoder": "qodercli --acp","traecli": "traecli acp serve","grok": "grok agent stdio",+ "qwen": "qwen -p (stream-json)",}// LaunchHeader returns the user-visible launch skeleton for agentType, or andiff --git a/server/pkg/agent/agent_supported_types_test.go b/server/pkg/agent/agent_supported_types_test.goindex 7a4174362f..6ca5d4184a 100644--- a/server/pkg/agent/agent_supported_types_test.go+++ b/server/pkg/agent/agent_supported_types_test.go@@ -40,7 +40,7 @@ func TestSupportedTypesMatchesMigrationWhitelist(t *testing.T) {"claude": true, "codebuddy": true, "codex": true, "copilot": true,"opencode": true, "deveco": true, "openclaw": true, "hermes": true,"pi": true, "cursor": true, "kimi": true, "kiro": true, "antigravity": true,- "qoder": true, "traecli": true, "grok": true,+ "qoder": true, "traecli": true, "grok": true, "qwen": true,}if len(SupportedTypes) != len(want) {t.Fatalf("SupportedTypes has %d entries, migration whitelist has %d; keep them in lockstep", len(SupportedTypes), len(want))diff --git a/server/pkg/agent/agent_test.go b/server/pkg/agent/agent_test.goindex 0769adc68b..1f03e64bba 100644--- a/server/pkg/agent/agent_test.go+++ b/server/pkg/agent/agent_test.go@@ -169,15 +169,10 @@ func TestDetectVersionTimesOutOnHang(t *testing.T) {func TestLaunchHeaderCoversAllSupportedBackends(t *testing.T) {t.Parallel()- // The factory in New() enumerates every supported agent type; LaunchHeader- // must stay in sync so the UI preview never shows an empty skeleton for a- // runtime the daemon actually spawns. If a new backend is added, add an- // entry to launchHeaders in agent.go and extend this list.- supported := []string{- "antigravity", "claude", "codebuddy", "codex", "copilot", "cursor",- "grok", "hermes", "kimi", "kiro", "openclaw", "opencode", "pi", "qoder", "traecli",- }- for _, t_ := range supported {+ // SupportedTypes is the canonical factory/profile whitelist. Iterating it+ // directly prevents this coverage check from drifting when a backend is+ // added, so the UI preview always has a launch skeleton.+ for _, t_ := range SupportedTypes {if header := LaunchHeader(t_); header == "" {t.Errorf("LaunchHeader(%q) returned empty string — add it to launchHeaders", t_)}diff --git a/server/pkg/agent/claude_test.go b/server/pkg/agent/claude_test.goindex 6d397d2df6..76ee5811d4 100644--- a/server/pkg/agent/claude_test.go+++ b/server/pkg/agent/claude_test.go@@ -794,6 +794,15 @@ func TestWriteMcpConfigToTemp(t *testing.T) {if !bytes.Equal(data, []byte(raw)) {t.Fatalf("expected %s, got %s", raw, data)}+ if runtime.GOOS != "windows" {+ info, err := os.Stat(path)+ if err != nil {+ t.Fatalf("stat temp file %s: %v", path, err)+ }+ if info.Mode().Perm()&0o077 != 0 {+ t.Fatalf("temp MCP file permissions = %o, want no group/other access", info.Mode().Perm())+ }+ }// Cleanup should remove the temp directory and every related sidecar file.cleanupMcpConfigTemp(path)diff --git a/server/pkg/agent/models.go b/server/pkg/agent/models.goindex 6aef34b17b..f4d4ac99da 100644--- a/server/pkg/agent/models.go+++ b/server/pkg/agent/models.go@@ -165,6 +165,11 @@ func ListModels(ctx context.Context, providerType, executablePath string) ([]ModannotateCodebuddyThinking(ctx, models, executablePath)return models, nil})+ case "qwen":+ // Qwen Code has no account-independent headless model catalog. An+ // empty list keeps the runtime default and manual model entry available+ // without advertising a Token-Plan-specific model to other accounts.+ return []Model{}, nilcase "grok":// xAI Grok Build is ACP-native (`grok agent stdio`); model catalog// comes from session/new. Falls back to a small static list so thediff --git a/server/pkg/agent/models_test.go b/server/pkg/agent/models_test.goindex 2b8d823c42..9f3f5fab27 100644--- a/server/pkg/agent/models_test.go+++ b/server/pkg/agent/models_test.go@@ -30,6 +30,16 @@ func TestListModelsStaticProviders(t *testing.T) {}}+func TestListModelsQwenUsesRuntimeDefaultAndManualEntry(t *testing.T) {+ got, err := ListModels(context.Background(), "qwen", "")+ if err != nil {+ t.Fatalf("ListModels(qwen) error: %v", err)+ }+ if len(got) != 0 {+ t.Fatalf("ListModels(qwen) = %+v, want no account-specific static catalog", got)+ }+}+func TestListModelsCopilotFallsBackToStatic(t *testing.T) {// Copilot uses dynamic ACP discovery, but with no `copilot`// binary on PATH (the discovery LookPath fails) it must falldiff --git a/server/pkg/agent/qwen.go b/server/pkg/agent/qwen.gonew file mode 100644index 0000000000..09d11023ae--- /dev/null+++ b/server/pkg/agent/qwen.go@@ -0,0 +1,345 @@+package agent++import (+ "bufio"+ "context"+ "encoding/json"+ "fmt"+ "log/slog"+ "os/exec"+ "strings"+ "time"+)++// qwenBackend drives Qwen Code's native non-interactive JSONL protocol:+// qwen -p <prompt> --output-format stream-json. The event schema is based on+// Qwen Code 0.20.0 captures in testdata/qwen-code-0.20.0-stream-json.jsonl.+type qwenBackend struct {+ cfg Config+}++// qwenBlockedArgs are owned by Multica. Qwen accepts the task prompt and stream+// protocol as flags, so custom args must not replace either. Model/session are+// also selected by Multica, and safe mode disables the QWEN.md context file.+var qwenBlockedArgs = map[string]blockedArgMode{+ "-p": blockedWithValue,+ "--prompt": blockedWithValue,+ "-i": blockedWithValue,+ "--prompt-interactive": blockedWithValue,+ "-o": blockedWithValue,+ "--output-format": blockedWithValue,+ "-m": blockedWithValue,+ "--model": blockedWithValue,+ "-r": blockedWithValue,+ "--resume": blockedWithValue,+ "-c": blockedStandalone,+ "--continue": blockedStandalone,+ "--chat-recording": blockedWithValue,+ "--mcp-config": blockedWithValue,+ "--safe-mode": blockedStandalone,+}++func buildQwenArgs(prompt string, opts ExecOptions, logger *slog.Logger) []string {+ args := []string{"-p", prompt, "--output-format", "stream-json"}+ if opts.Model != "" {+ args = append(args, "--model", opts.Model)+ }+ if opts.ResumeSessionID != "" {+ args = append(args, "--resume", opts.ResumeSessionID)+ }+ args = append(args, filterCustomArgs(opts.ExtraArgs, qwenBlockedArgs, logger)...)+ args = append(args, filterCustomArgs(opts.CustomArgs, qwenBlockedArgs, logger)...)+ return args+}++func (b *qwenBackend) Execute(ctx context.Context, prompt string, opts ExecOptions) (*Session, error) {+ execPath := b.cfg.ExecutablePath+ if execPath == "" {+ execPath = "qwen"+ }+ if _, err := exec.LookPath(execPath); err != nil {+ return nil, fmt.Errorf("qwen executable not found at %q: %w", execPath, err)+ }+ timeout := opts.Timeout+ runCtx, cancel := runContext(ctx, timeout)+ args := buildQwenArgs(prompt, opts, b.cfg.Logger)++ // Qwen Code 0.20.0 accepts a JSON string or a file path through+ // --mcp-config. Materialise a managed config into a 0600 temp file so it+ // does not appear in argv or logs, then remove it when the process exits.+ var mcpConfigPath string+ var mcpFileCleanup func()+ if hasManagedMcpConfig(opts.McpConfig) {+ path, err := writeMcpConfigToTemp(opts.McpConfig)+ if err != nil {+ cancel()+ return nil, fmt.Errorf("write qwen mcp_config: %w", err)+ }+ mcpConfigPath = path+ mcpFileCleanup = func() { cleanupMcpConfigTemp(mcpConfigPath) }+ args = append(args, "--mcp-config", mcpConfigPath)+ }+ // Clean up if a later setup step returns before the result goroutine owns it.+ defer func() {+ if mcpFileCleanup != nil {+ mcpFileCleanup()+ }+ }()+ cmd := exec.CommandContext(runCtx, execPath, args...)+ hideAgentWindow(cmd)+ // args contain the task prompt; never expose it in daemon logs.+ b.cfg.Logger.Info("agent command", "exec", execPath, "provider", "qwen")+ cmd.WaitDelay = 10 * time.Second+ if opts.Cwd != "" {+ cmd.Dir = opts.Cwd+ }+ cmd.Env = buildEnv(b.cfg.Env)++ stdout, err := cmd.StdoutPipe()+ if err != nil {+ cancel()+ return nil, fmt.Errorf("qwen stdout pipe: %w", err)+ }+ stderrBuf := newStderrTail(newLogWriter(b.cfg.Logger, "[qwen:stderr] "), agentStderrTailBytes)+ cmd.Stderr = stderrBuf+ if err := cmd.Start(); err != nil {+ cancel()+ return nil, fmt.Errorf("start qwen: %w", err)+ }+ // cmd.Start succeeded; result goroutine now owns cleanup.+ mcpFileCleanup = nil+ b.cfg.Logger.Info("qwen started", "pid", cmd.Process.Pid, "cwd", opts.Cwd, "model", opts.Model)++ msgCh := make(chan Message, 256)+ resCh := make(chan Result, 1)+ go func() {+ defer cancel()+ defer close(msgCh)+ defer close(resCh)+ if mcpConfigPath != "" {+ defer cleanupMcpConfigTemp(mcpConfigPath)+ }++ started := time.Now()+ state := qwenStreamState{model: opts.Model, usage: make(map[string]TokenUsage)}+ go func() {+ <-runCtx.Done()+ _ = stdout.Close()+ }()++ scanner := bufio.NewScanner(stdout)+ scanner.Buffer(make([]byte, 0, 1024*1024), 10*1024*1024)+ for scanner.Scan() {+ line := strings.TrimSpace(scanner.Text())+ if line == "" {+ continue+ }+ var event qwenStreamEvent+ if err := json.Unmarshal([]byte(line), &event); err != nil {+ state.invalidEventCount+++ continue+ }+ state.eventCount+++ state.lastEventType = event.Type+ handleQwenEvent(event, msgCh, &state)+ }+ scanErr := scanner.Err()+ if scanErr != nil {+ _ = stdout.Close()+ }+ exitErr := cmd.Wait()+ duration := time.Since(started)++ status, output, errMsg := finalizeStreamResult("qwen", timeout, runCtx.Err(), nil, exitErr, state.sessionID, streamTerminalState{+ lastAssistantText: state.lastAssistantText,+ finalResultText: state.finalResultText,+ sawResult: state.sawResult,+ resultIsError: state.resultIsError,+ scanErr: scanErr,+ }, "")+ if errMsg != "" {+ errMsg = withAgentStderr(errMsg, "qwen", stderrBuf.Tail())+ }+ logStreamProtocolObservation(b.cfg.Logger, streamProtocolObservation{+ provider: "qwen", cliVersion: b.cfg.CLIVersion, model: state.model,+ exitCode: streamProcessExitCode(exitErr), eventCount: state.eventCount,+ invalidEventCount: state.invalidEventCount, assistantEventCount: state.assistantEventCount,+ toolUseCount: state.toolUseCount, sawResult: state.sawResult, resultIsError: state.resultIsError,+ resultBytes: len(state.finalResultText), lastAssistantBytes: len(state.lastAssistantText),+ scannerError: scanErr != nil, lastEventType: state.lastEventType,+ })+ b.cfg.Logger.Info("qwen finished", "pid", cmd.Process.Pid, "status", status, "duration", duration.Round(time.Millisecond).String())+ resCh <- Result{+ Status: status, Output: output, Error: errMsg, DurationMs: duration.Milliseconds(),+ SessionID: resolveSessionID(opts.ResumeSessionID, state.sessionID, status == "failed"), Usage: state.usage,+ }+ }()+ return &Session{Messages: msgCh, Result: resCh}, nil+}++type qwenStreamEvent struct {+ Type string `json:"type"`+ Subtype string `json:"subtype,omitempty"`+ SessionID string `json:"session_id,omitempty"`+ Model string `json:"model,omitempty"`+ Message json.RawMessage `json:"message,omitempty"`+ Result string `json:"result,omitempty"`+ IsError bool `json:"is_error,omitempty"`+ Usage *qwenUsage `json:"usage,omitempty"`+ Error json.RawMessage `json:"error,omitempty"`+}++type qwenMessage struct {+ Model string `json:"model,omitempty"`+ Content []qwenContentBlock `json:"content"`+ Usage *qwenUsage `json:"usage,omitempty"`+}++type qwenUsage struct {+ InputTokens int64 `json:"input_tokens"`+ OutputTokens int64 `json:"output_tokens"`+ CacheReadInputTokens int64 `json:"cache_read_input_tokens"`+}++type qwenContentBlock struct {+ Type string `json:"type"`+ Thinking string `json:"thinking,omitempty"`+ Text string `json:"text,omitempty"`+ ID string `json:"id,omitempty"`+ Name string `json:"name,omitempty"`+ Input json.RawMessage `json:"input,omitempty"`+ ToolUseID string `json:"tool_use_id,omitempty"`+ Content json.RawMessage `json:"content,omitempty"`+}++type qwenStreamState struct {+ sessionID, model, lastAssistantText, finalResultText, lastEventType string+ sawResult, resultIsError bool+ usage map[string]TokenUsage+ eventCount, invalidEventCount, assistantEventCount, toolUseCount int+}++func handleQwenEvent(event qwenStreamEvent, ch chan<- Message, state *qwenStreamState) {+ if event.SessionID != "" {+ state.sessionID = event.SessionID+ }+ if event.Model != "" {+ state.model = event.Model+ }+ switch event.Type {+ case "system":+ trySend(ch, Message{Type: MessageStatus, Status: "running", SessionID: state.sessionID})+ case "assistant":+ state.assistantEventCount+++ text, tools, model := handleQwenAssistant(event.Message, ch, state.usage)+ if model != "" {+ state.model = model+ }+ state.toolUseCount += tools+ if tools == 0 && text != "" {+ state.lastAssistantText = text+ } else if tools > 0 {+ state.lastAssistantText = ""+ }+ case "user":+ handleQwenUser(event.Message, ch)+ case "result":+ state.sawResult = true+ state.resultIsError = event.IsError || event.Subtype == "error" || event.Subtype == "failed"+ if state.resultIsError {+ // Qwen 0.20.0 result errors omit result; their actionable detail+ // is in error.message.+ state.finalResultText = qwenErrorText(event)+ } else {+ state.finalResultText = event.Result+ }+ if usage := qwenResultUsage(event.Usage, state.model); len(usage) > 0 {+ state.usage = usage+ }+ case "error":+ // Be fail-closed if a later Qwen release emits a terminal error event.+ state.sawResult = true+ state.resultIsError = true+ state.finalResultText = qwenErrorText(event)+ }+}++func handleQwenAssistant(raw json.RawMessage, ch chan<- Message, usage map[string]TokenUsage) (string, int, string) {+ var message qwenMessage+ if json.Unmarshal(raw, &message) != nil {+ return "", 0, ""+ }+ if message.Usage != nil && message.Model != "" {+ usage[message.Model] = qwenTokenUsage(message.Usage)+ }+ var text strings.Builder+ tools := 0+ for _, block := range message.Content {+ switch block.Type {+ case "thinking":+ if block.Thinking != "" {+ trySend(ch, Message{Type: MessageThinking, Content: block.Thinking})+ }+ case "text":+ if block.Text != "" {+ text.WriteString(block.Text)+ trySend(ch, Message{Type: MessageText, Content: block.Text})+ }+ case "tool_use":+ tools+++ var input map[string]any+ if len(block.Input) > 0 {+ _ = json.Unmarshal(block.Input, &input)+ }+ trySend(ch, Message{Type: MessageToolUse, Tool: block.Name, CallID: block.ID, Input: input})+ }+ }+ return text.String(), tools, message.Model+}++func handleQwenUser(raw json.RawMessage, ch chan<- Message) {+ var message qwenMessage+ if json.Unmarshal(raw, &message) != nil {+ return+ }+ for _, block := range message.Content {+ if block.Type == "tool_result" {+ trySend(ch, Message{Type: MessageToolResult, CallID: block.ToolUseID, Output: qwenToolResultOutput(block.Content)})+ }+ }+}++func qwenTokenUsage(usage *qwenUsage) TokenUsage {+ return TokenUsage{InputTokens: usage.InputTokens, OutputTokens: usage.OutputTokens, CacheReadTokens: usage.CacheReadInputTokens}+}++func qwenResultUsage(usage *qwenUsage, model string) map[string]TokenUsage {+ if usage == nil || model == "" || (usage.InputTokens == 0 && usage.OutputTokens == 0 && usage.CacheReadInputTokens == 0) {+ return nil+ }+ return map[string]TokenUsage{model: qwenTokenUsage(usage)}+}++func qwenToolResultOutput(raw json.RawMessage) string {+ var text string+ if json.Unmarshal(raw, &text) == nil {+ return text+ }+ return string(raw)+}++func qwenErrorText(event qwenStreamEvent) string {+ if event.Result != "" {+ return event.Result+ }+ var body struct {+ Message string `json:"message"`+ }+ if json.Unmarshal(event.Error, &body) == nil && body.Message != "" {+ return body.Message+ }+ if len(event.Error) > 0 {+ return string(event.Error)+ }+ return "qwen returned an error event without details"+}diff --git a/server/pkg/agent/qwen_test.go b/server/pkg/agent/qwen_test.gonew file mode 100644index 0000000000..2ecc41d5da--- /dev/null+++ b/server/pkg/agent/qwen_test.go@@ -0,0 +1,304 @@+package agent++import (+ "context"+ "encoding/json"+ "log/slog"+ "os"+ "path/filepath"+ "runtime"+ "strings"+ "testing"+ "time"+)++func TestNewReturnsQwenBackend(t *testing.T) {+ t.Parallel()+ backend, err := New("qwen", Config{ExecutablePath: "/nonexistent/qwen"})+ if err != nil {+ t.Fatalf("New(qwen): %v", err)+ }+ if _, ok := backend.(*qwenBackend); !ok {+ t.Fatalf("New(qwen) = %T, want *qwenBackend", backend)+ }+}++func TestBuildQwenArgsKeepsProtocolManaged(t *testing.T) {+ t.Parallel()+ args := buildQwenArgs("task prompt", ExecOptions{+ Model: "qwen3.8-max-preview",+ ResumeSessionID: "session-1",+ ExtraArgs: []string{"--output-format", "text", "--sandbox"},+ CustomArgs: []string{+ "--prompt=replace", "-o", "json", "--model", "other", "--resume", "other-session",+ "--safe-mode", "--chat-recording", "false", "--mcp-config", "injected-mcp.json", "--mcp-config=inline-mcp.json", "--debug",+ },+ }, slog.Default())+ joined := strings.Join(args, " ")+ for _, forbidden := range []string{"text", "replace", "other-session", "other", "--safe-mode", "--chat-recording", "injected-mcp.json", "inline-mcp.json"} {+ if strings.Contains(joined, forbidden) {+ t.Fatalf("managed argument %q leaked into %v", forbidden, args)+ }+ }+ wantPrefix := []string{"-p", "task prompt", "--output-format", "stream-json", "--model", "qwen3.8-max-preview", "--resume", "session-1"}+ if len(args) < len(wantPrefix) {+ t.Fatalf("args too short: %v", args)+ }+ for i, want := range wantPrefix {+ if args[i] != want {+ t.Fatalf("args[%d] = %q, want %q; all=%v", i, args[i], want, args)+ }+ }+ if !strings.Contains(joined, "--sandbox") || !strings.Contains(joined, "--debug") {+ t.Fatalf("non-managed custom args missing from %v", args)+ }+}++func fakeQwenScript() string {+ return `#!/bin/sh+if [ -n "$QWEN_ARGS_FILE" ]; then printf '%s\n' "$@" > "$QWEN_ARGS_FILE"; fi+while [ "$#" -gt 0 ]; do+ if [ "$1" = "--mcp-config" ] && [ -n "$QWEN_MCP_CAPTURE_FILE" ]; then cp "$2" "$QWEN_MCP_CAPTURE_FILE"; break; fi+ shift+done+case "$QWEN_MODE" in+ error)+ printf '%s\n' '{"type":"system","subtype":"init","session_id":"sess-error","model":"qwen-test"}'+ printf '%s\n' '{"type":"result","subtype":"error_during_execution","session_id":"sess-error","is_error":true,"error":{"type":"authentication_error","message":"synthetic Qwen authentication failure"}}'+ ;;+ exit)+ echo 'synthetic qwen stderr' >&2+ exit 7+ ;;+ resume-missing)+ cat "$QWEN_STDERR_FIXTURE" >&2+ exit 1+ ;;+ spin)+ while :; do :; done+ ;;+ *)+ printf '%s\n' '{"type":"system","subtype":"init","session_id":"sess-qwen-1","model":"qwen-test"}'+ printf '%s\n' '{"type":"assistant","session_id":"sess-qwen-1","message":{"role":"assistant","model":"qwen-test","content":[{"type":"thinking","thinking":"considering"}]}}'+ printf '%s\n' '{"type":"assistant","session_id":"sess-qwen-1","message":{"role":"assistant","model":"qwen-test","content":[{"type":"tool_use","id":"call-1","name":"list_directory","input":{"path":"/work"}}]}}'+ printf '%s\n' '{"type":"user","session_id":"sess-qwen-1","message":{"role":"user","content":[{"type":"tool_result","tool_use_id":"call-1","content":"Listed 1 item"}]}}'+ printf '%s\n' '{"type":"assistant","session_id":"sess-qwen-1","message":{"role":"assistant","model":"qwen-test","content":[{"type":"text","text":"PONG"}],"usage":{"input_tokens":10,"output_tokens":2,"cache_read_input_tokens":3}}}'+ printf '%s\n' '{"type":"result","subtype":"success","session_id":"sess-qwen-1","is_error":false,"result":"PONG","usage":{"input_tokens":20,"output_tokens":4,"cache_read_input_tokens":6}}'+ ;;+esac+`+}++func newFakeQwenBackend(t *testing.T, env map[string]string) *qwenBackend {+ t.Helper()+ if runtime.GOOS == "windows" {+ t.Skip("shell fixture is POSIX-only")+ }+ path := filepath.Join(t.TempDir(), "qwen")+ writeTestExecutable(t, path, []byte(fakeQwenScript()))+ return &qwenBackend{cfg: Config{ExecutablePath: path, Logger: slog.Default(), Env: env}}+}++func awaitQwenResult(t *testing.T, session *Session) ([]Message, Result) {+ t.Helper()+ var messages []Message+ for message := range session.Messages {+ messages = append(messages, message)+ }+ select {+ case result, ok := <-session.Result:+ if !ok {+ t.Fatal("result channel closed without a result")+ }+ return messages, result+ case <-time.After(5 * time.Second):+ t.Fatal("timed out waiting for qwen result")+ return nil, Result{}+ }+}++func TestQwenBackendStreamsNativeEvents(t *testing.T) {+ t.Parallel()+ backend := newFakeQwenBackend(t, nil)+ session, err := backend.Execute(context.Background(), "reply PONG", ExecOptions{Model: "qwen-test", Timeout: 5 * time.Second})+ if err != nil {+ t.Fatalf("Execute: %v", err)+ }+ messages, result := awaitQwenResult(t, session)+ if result.Status != "completed" || result.Output != "PONG" || result.SessionID != "sess-qwen-1" {+ t.Fatalf("unexpected result: %+v", result)+ }+ usage := result.Usage["qwen-test"]+ if usage.InputTokens != 20 || usage.OutputTokens != 4 || usage.CacheReadTokens != 6 {+ t.Fatalf("unexpected final usage: %+v", usage)+ }+ var thinking, toolUse, toolResult, text bool+ for _, message := range messages {+ switch message.Type {+ case MessageThinking:+ thinking = message.Content == "considering"+ case MessageToolUse:+ toolUse = message.Tool == "list_directory" && message.CallID == "call-1" && message.Input["path"] == "/work"+ case MessageToolResult:+ toolResult = message.CallID == "call-1" && message.Output == "Listed 1 item"+ case MessageText:+ text = message.Content == "PONG"+ }+ }+ if !thinking || !toolUse || !toolResult || !text {+ t.Fatalf("missing native events thinking=%v toolUse=%v toolResult=%v text=%v; messages=%+v", thinking, toolUse, toolResult, text, messages)+ }+}++func TestQwenBackendPreservesSuccessfulResumeSession(t *testing.T) {+ t.Parallel()+ backend := newFakeQwenBackend(t, nil)+ session, err := backend.Execute(context.Background(), "continue task", ExecOptions{+ Model: "qwen-test", ResumeSessionID: "sess-qwen-1", Timeout: 5 * time.Second,+ })+ if err != nil {+ t.Fatalf("Execute: %v", err)+ }+ _, result := awaitQwenResult(t, session)+ if result.Status != "completed" || result.Output != "PONG" || result.SessionID != "sess-qwen-1" {+ t.Fatalf("resumed result = %+v", result)+ }+}++func newQwenTestContext() (context.Context, context.CancelFunc) {+ return context.WithCancel(context.Background())+}++func TestQwenBackendFailureTimeoutAndCancellation(t *testing.T) {+ if runtime.GOOS == "windows" {+ t.Skip("shell fixture is POSIX-only")+ }+ resumeFixture, err := filepath.Abs(filepath.Join("testdata", "qwen-code-0.20.0-resume-not-found.stderr.txt"))+ if err != nil {+ t.Fatalf("resolve resume fixture: %v", err)+ }+ for _, tc := range []struct {+ name string+ env map[string]string+ ctx func() (context.Context, context.CancelFunc)+ opts ExecOptions+ status string+ needle string+ wantSession string+ }{+ {"result error", map[string]string{"QWEN_MODE": "error"}, newQwenTestContext, ExecOptions{}, "failed", "synthetic Qwen authentication failure", "sess-error"},+ {"process error", map[string]string{"QWEN_MODE": "exit"}, newQwenTestContext, ExecOptions{}, "failed", "synthetic qwen stderr", ""},+ {"missing resume", map[string]string{"QWEN_MODE": "resume-missing", "QWEN_STDERR_FIXTURE": resumeFixture}, newQwenTestContext, ExecOptions{ResumeSessionID: "session-redacted"}, "failed", "No saved session found", ""},+ {"timeout", map[string]string{"QWEN_MODE": "spin"}, newQwenTestContext, ExecOptions{Timeout: 20 * time.Millisecond}, "timeout", "timed out", ""},+ {"cancel", map[string]string{"QWEN_MODE": "spin"}, newQwenTestContext, ExecOptions{}, "aborted", "cancelled", ""},+ } {+ t.Run(tc.name, func(t *testing.T) {+ ctx, cancel := tc.ctx()+ if tc.name == "cancel" {+ go func() { time.Sleep(20 * time.Millisecond); cancel() }()+ } else {+ defer cancel()+ }+ session, err := newFakeQwenBackend(t, tc.env).Execute(ctx, "task", tc.opts)+ if err != nil {+ t.Fatalf("Execute: %v", err)+ }+ _, result := awaitQwenResult(t, session)+ if result.Status != tc.status || !strings.Contains(result.Error, tc.needle) || result.SessionID != tc.wantSession {+ t.Fatalf("result = %+v, want status=%q error containing %q session=%q", result, tc.status, tc.needle, tc.wantSession)+ }+ })+ }+}++func TestQwenBackendPassesManagedMCPThroughTempFile(t *testing.T) {+ if runtime.GOOS == "windows" {+ t.Skip("shell fixture is POSIX-only")+ }+ capturePath := filepath.Join(t.TempDir(), "qwen.mcp.json")+ argsPath := filepath.Join(t.TempDir(), "qwen.args")+ mcpConfig := json.RawMessage(`{"mcpServers":{"demo":{"command":"echo","args":["hello"]}}}`)+ backend := newFakeQwenBackend(t, map[string]string{"QWEN_ARGS_FILE": argsPath, "QWEN_MCP_CAPTURE_FILE": capturePath})+ session, err := backend.Execute(context.Background(), "task", ExecOptions{McpConfig: mcpConfig})+ if err != nil {+ t.Fatalf("Execute: %v", err)+ }+ _, result := awaitQwenResult(t, session)+ if result.Status != "completed" {+ t.Fatalf("result = %+v", result)+ }+ argsData, err := os.ReadFile(argsPath)+ if err != nil {+ t.Fatalf("read qwen args: %v", err)+ }+ args := strings.Split(strings.TrimSpace(string(argsData)), "\n")+ mcpPath := ""+ for i, arg := range args {+ if arg == "--mcp-config" && i+1 < len(args) {+ mcpPath = args[i+1]+ break+ }+ }+ if mcpPath == "" {+ t.Fatalf("managed MCP argument missing from %v", args)+ }+ data, err := os.ReadFile(capturePath)+ if err != nil {+ t.Fatalf("read captured managed MCP file: %v", err)+ }+ if string(data) != string(mcpConfig) {+ t.Fatalf("managed MCP file = %s, want %s", data, mcpConfig)+ }+ if _, err := os.Stat(mcpPath); !os.IsNotExist(err) {+ t.Fatalf("managed MCP file should be removed after completion, stat err=%v", err)+ }+}++func TestQwenCode020FixtureParses(t *testing.T) {+ t.Parallel()+ data, err := os.ReadFile(filepath.Join("testdata", "qwen-code-0.20.0-stream-json.jsonl"))+ if err != nil {+ t.Fatal(err)+ }+ state := qwenStreamState{usage: make(map[string]TokenUsage)}+ messages := make(chan Message, 16)+ for _, line := range strings.Split(strings.TrimSpace(string(data)), "\n") {+ var event qwenStreamEvent+ if err := json.Unmarshal([]byte(line), &event); err != nil {+ t.Fatalf("fixture event: %v\n%s", err, line)+ }+ handleQwenEvent(event, messages, &state)+ }+ if !state.sawResult || state.resultIsError || state.sessionID != "session-redacted" || state.finalResultText != "DONE" {+ t.Fatalf("unexpected fixture state: %+v", state)+ }+ if state.usage["qwen3.8-max-preview"].InputTokens != 46539 {+ t.Fatalf("fixture usage = %+v", state.usage)+ }+}++func TestQwenCode020ErrorFixturePreservesErrorMessage(t *testing.T) {+ t.Parallel()+ data, err := os.ReadFile(filepath.Join("testdata", "qwen-code-0.20.0-error-stream-json.jsonl"))+ if err != nil {+ t.Fatal(err)+ }+ state := qwenStreamState{usage: make(map[string]TokenUsage)}+ messages := make(chan Message, 4)+ for _, line := range strings.Split(strings.TrimSpace(string(data)), "\n") {+ var event qwenStreamEvent+ if err := json.Unmarshal([]byte(line), &event); err != nil {+ t.Fatalf("fixture event: %v\n%s", err, line)+ }+ handleQwenEvent(event, messages, &state)+ }+ if !state.sawResult || !state.resultIsError {+ t.Fatalf("unexpected terminal state: %+v", state)+ }+ if state.sessionID != "session-error-redacted" {+ t.Fatalf("session ID = %q", state.sessionID)+ }+ if state.finalResultText != "Authentication failed: credential redacted" {+ t.Fatalf("error detail = %q", state.finalResultText)+ }+}diff --git a/server/pkg/agent/testdata/qwen-code-0.20.0-error-stream-json.jsonl b/server/pkg/agent/testdata/qwen-code-0.20.0-error-stream-json.jsonlnew file mode 100644index 0000000000..80d65b52d1--- /dev/null+++ b/server/pkg/agent/testdata/qwen-code-0.20.0-error-stream-json.jsonl@@ -0,0 +1,2 @@+{"type":"system","subtype":"init","uuid":"redacted","session_id":"session-error-redacted","cwd":"/redacted/workdir","model":"qwen3.8-max-preview","qwen_code_version":"0.20.0"}+{"type":"result","subtype":"error_during_execution","uuid":"redacted","session_id":"session-error-redacted","is_error":true,"duration_ms":17,"duration_api_ms":12,"num_turns":1,"usage":{"input_tokens":42,"output_tokens":0,"cache_read_input_tokens":0,"total_tokens":42},"permission_denials":[],"error":{"type":"authentication_error","message":"Authentication failed: credential redacted"}}diff --git a/server/pkg/agent/testdata/qwen-code-0.20.0-resume-not-found.stderr.txt b/server/pkg/agent/testdata/qwen-code-0.20.0-resume-not-found.stderr.txtnew file mode 100644index 0000000000..bd0410cfe0--- /dev/null+++ b/server/pkg/agent/testdata/qwen-code-0.20.0-resume-not-found.stderr.txt@@ -0,0 +1 @@+No saved session found with ID session-redacted. Run `qwen --resume` without an ID to choose from existing sessions.diff --git a/server/pkg/agent/testdata/qwen-code-0.20.0-stream-json.jsonl b/server/pkg/agent/testdata/qwen-code-0.20.0-stream-json.jsonlnew file mode 100644index 0000000000..56a365a6d9--- /dev/null+++ b/server/pkg/agent/testdata/qwen-code-0.20.0-stream-json.jsonl@@ -0,0 +1,6 @@+{"type":"system","subtype":"init","uuid":"redacted","session_id":"session-redacted","cwd":"/redacted/workdir","tools":["list_directory"],"model":"qwen3.8-max-preview","permission_mode":"auto","qwen_code_version":"0.20.0"}+{"type":"assistant","uuid":"redacted","session_id":"session-redacted","message":{"id":"redacted","type":"message","role":"assistant","model":"qwen3.8-max-preview","content":[{"type":"thinking","thinking":"Use the requested read-only tool.","signature":""}],"stop_reason":null,"usage":{"input_tokens":0,"output_tokens":0}}}+{"type":"assistant","uuid":"redacted","session_id":"session-redacted","message":{"id":"redacted","type":"message","role":"assistant","model":"qwen3.8-max-preview","content":[{"type":"tool_use","id":"call-redacted","name":"list_directory","input":{"path":"/redacted/workdir"}}],"stop_reason":"tool_use","usage":{"input_tokens":23066,"output_tokens":119,"cache_read_input_tokens":18840,"total_tokens":23185}}}+{"type":"user","uuid":"redacted","session_id":"session-redacted","message":{"role":"user","content":[{"type":"tool_result","tool_use_id":"call-redacted","is_error":false,"content":"Listed 40 item(s)"}]}}+{"type":"assistant","uuid":"redacted","session_id":"session-redacted","message":{"id":"redacted","type":"message","role":"assistant","model":"qwen3.8-max-preview","content":[{"type":"text","text":"DONE"}],"stop_reason":null,"usage":{"input_tokens":23473,"output_tokens":40,"cache_read_input_tokens":23060,"total_tokens":23513}}}+{"type":"result","subtype":"success","uuid":"redacted","session_id":"session-redacted","is_error":false,"duration_ms":21372,"num_turns":2,"result":"DONE","usage":{"input_tokens":46539,"output_tokens":159,"cache_read_input_tokens":41900,"total_tokens":46698}}diff --git a/server/pkg/agent/version.go b/server/pkg/agent/version.goindex 2a8bd9c1fe..89e391a633 100644--- a/server/pkg/agent/version.go+++ b/server/pkg/agent/version.go@@ -15,6 +15,7 @@ var MinVersions = map[string]string{"codex": "0.100.0", // app-server --listen stdio:// added in 0.100.0"copilot": "1.0.0", // --output-format json envelope stable from 1.0.x"grok": "0.2.89", // ACP + authenticate/session-load/set_model/MCP and --effort thinking flag+ "qwen": "0.20.0", // stream-json protocol captured and verified against Qwen Code 0.20.0}// MinQuickCreateCLIVersion gates the agent-create (quick-create) flow againstdiff --git a/server/pkg/agent/version_test.go b/server/pkg/agent/version_test.goindex cfc4ae406c..95915ea4c4 100644--- a/server/pkg/agent/version_test.go+++ b/server/pkg/agent/version_test.go@@ -171,6 +171,9 @@ func TestCheckMinVersion(t *testing.T) {{"grok", "0.2.89", false},{"grok", "0.2.0", true},{"grok", "0.1.9", true},+ {"qwen", "0.20.0", false},+ {"qwen", "qwen 0.20.1", false},+ {"qwen", "0.19.9", true},{"unknown", "1.0.0", false},}for _, tt := range tests {