Skip to content

feat(clients): register Qwen Code during setup - #1415

Merged
morluto merged 2 commits into
morluto:mainfrom
yiliang114:feat/qwen-code-client
Oct 10, 2026
Merged

morluto merged 2 commits into
morluto:mainfrom
yiliang114:feat/qwen-code-client

Conversation

@yiliang114

@yiliang114 yiliang114 commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

TLDR

Adds Qwen Code as a supported setup client (--client qwen_code). rea setup now registers the MCP server in ~/.qwen/settings.json and installs the bundled skill where Qwen Code actually discovers skills (~/.qwen/skills), instead of the shared ~/.agents/skills root it never scans.

Closes #1409.

What this changes

Before this change, Qwen Code users had to register REA by hand with the documented manual MCP JSON, and a skill installed by guided setup was never discovered.

  • SupportedClients.ts — new qwen_code definition: configPath: [".qwen", "settings.json"], markerPath: [".qwen"], format: "json". The default JSON dialect already writes exactly what Qwen Code loads — mcpServers.rea → {command, args} — so no new dialect is needed. Detection, the interactive multi-select, doctor, and uninstall all derive from this registry.
  • SetupSkill.ts — new qwen_code skill family rooted at ~/.qwen/skills (mirrors the claude_code → ~/.claude/skills branch). Qwen Code discovers skills from project .qwen/skills/, user ~/.qwen/skills/, and its skills.directories setting — never from ~/.agents/skills — so a Qwen-Code-only selection no longer installs the shared root either.
  • SetupPlan.ts / Uninstall.ts — plan and removal labels for the Qwen skill copy (install_skill:qwen_code, "REA skill for Qwen Code").
  • Tests — new qwenClientConfiguration.test.ts: path resolution, register → read → uninstall round trip with JSONC comment preservation, aligned-status reporting, and skill-destination selection for qwen-only / mixed / audit-default scopes. Plus the detection-order expectation in clientLifecycle.test.ts.
  • docs/installation.md — client table row and a short paragraph noting the registration file and Qwen-specific skill directory.

Selection × skill roots after this change:

Selected clients Skill roots planned
qwen_code only ~/.qwen/skills
qwen_code + claude_code ~/.claude/skills, ~/.qwen/skills
qwen_code + any other non-Claude client shared ~/.agents/skills, ~/.qwen/skills
none / audit default (doctor --skill) shared, ~/.claude/skills, ~/.qwen/skills

Reviewer Test Plan

  1. npx tsc --noEmit and oxlint — clean (ran as npm run check:fast).
  2. npx vitest run --project boundary tests/boundary/filesystem/qwenClientConfiguration.test.ts tests/boundary/filesystem/setupSkill.test.ts tests/boundary/filesystem/clientLifecycle.test.ts tests/boundary/filesystem/clientRegistrationStatus.test.ts tests/boundary/filesystem/ompClientConfiguration.test.ts tests/boundary/filesystem/clientConfigurationDialects.test.ts tests/boundary/filesystem/clientConfigurationBom.test.ts tests/boundary/cli/productCatalog.test.ts — 126/126 pass locally on macOS arm64 (Node 24.18.0). [fixed the count: 126, not 133 — the 7 new tests were already inside the total, thanks @CassieFox23]
  3. End-to-end against the built CLI with a sandboxed HOME:
    • node scripts/rea.mjs setup --client qwen_code --dry-run --json → plans configure_client:qwen_code (with backup) and install_skill:qwen_code targeting ~/.qwen/settings.json and ~/.qwen/skills/reverse-engineer-anything.
    • node scripts/rea.mjs setup --yes --client qwen_code --json → ready; existing model setting preserved, mcpServers.rea added; skill lands in ~/.qwen/skills/reverse-engineer-anything and no ~/.agents directory is created.
    • node scripts/rea.mjs doctor --client qwen_code --json → healthy: true; a second setup run is a no-op.

Known Limitations

  • Project-level .qwen/settings.json and the skills.directories setting are intentionally untouched — user-level registration only, same boundary as other clients.
  • Full-suite honesty: npm run check:pr static gates (typecheck, lint, format:check, knip, metadata:check, docs:check) pass locally. The full vitest run is not macOS-clean on main itself — 155 failures in the same set of 39 files before and after this change (native Mach-O, Hopper, JADX, process-capture, Playwright/CDP areas; none touch client registration, setup, or skill code). The only branch-specific blip, webRuntimeCli, passes in isolation on both main and this branch (flaky under parallel load). CI on Linux is the real signal here.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@CassieFox23

CassieFox23 commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

TL;DR: I tested this on Linux in a fake home. Qwen Code (Apache-2.0) setup works end to end. Doctor and uninstall work too. I found two things worth a look. Both come from Qwen Code's own source.

Tests

Tests Node 22.23.1 Node 24.18.0 Node 26.11.1
The two changed test files 50 of 50 50 of 50 50 of 50
The eight files in your test plan 126 of 126 126 of 126 126 of 126
Your tests on the base commit 8 fail, 42 pass

Your plan says 133 tests. I count 126 here, with none skipped. I don't know why they differ.

Real use

Check Result
No ~/.qwen Not detected. It wrote nothing.
Empty ~/.qwen Detected. The dry run wrote nothing.
Setup with --yes Added rea as a pinned npx entry for rea-agents 6.3.0. The skill went to ~/.qwen/skills.
Other keys in the file Kept byte for byte. A backup was made.
Doctor It said healthy. The entry and skill were "aligned".
Uninstall Took out only rea and the skill. The file came back exactly.
Bad files Broken JSON and dangling links were refused.
FIFO All four commands hang. Gemini CLI does too. #1379 fixes it.
Project .qwen Never written.

Worth a look

  1. Qwen Code reads ~/.agents/skills too. It has since v0.13.0. See SKILL_PROVIDER_CONFIG_DIRS in packages/core/src/config/storage.ts. Two copies with one name are fine. The .qwen copy wins. Still, the docs and the code comment say it skips that folder. Maybe the Qwen skill folder isn't needed. Or keep it and fix the words.
  2. Qwen Code moves its folder when QWEN_HOME is set. Its settings and skills go there. Setup ignores it. With QWEN_HOME set, setup does not detect Qwen Code. It still writes ~/.qwen/settings.json. Codex here already follows CODEX_HOME. Note that ~/.agents/skills does not move with QWEN_HOME. So the shared copy keeps working either way.

I read both in Qwen Code's source. I did not run Qwen Code.

Not run

Edit: I ran some of these on main at 40f73f6 (#3735). Results are in my new comment. Still not run: the full npm test, a chat or tool call through Qwen Code, and Windows and macOS.

  • Qwen Code itself. It is not installed here. Ran Qwen Code 0.25.1 with qwen mcp list only. No chat, no model.
  • The saved npx command. Ran on main. It starts REA 6.5.0 and lists 207 tools.
  • Windows and macOS.
  • Full npm test, npm run check and docs:check. npm run check and docs:check ran on main, both exit 0. The full npm test is still not run.

Thanks for this, yiliang114!

All checks
Check Qwen Code Gemini CLI on the same build
Setup without --yes Asked for approval. Wrote nothing. —
Second setup No change. —
Backup settings.json.rea.backup, same bytes as before. Same
Comment in the file Kept through setup and uninstall. —
One-line mcpServers Reflowed to many lines after a round trip. Same
Broken JSON Refused. File unchanged. Exit 1. Same
Symlink Wrote to the target. Link kept. Same
Link to a missing file Refused. Exit 1. Same
FIFO All four commands hung until timeout 20. Same
FIFO with #1379 added Refused at once on all four. —
Project decoy file Left alone. —
uninstall --client Not a flag. Plain uninstall covers it. —
Uninstall leftovers Empty mcpServers, an empty skills folder, a backup. Same

The FIFO hang is not new. #1379 fixes it for Qwen Code too.

In the new test, the last toContain checks text from before uninstall. It does not read the file again. In real use the comment was kept anyway.

Typecheck passed. Oxlint gave no new warnings. The module check needs git. I tested from an export.

Overlap with other PRs
Commands

Each run used a fresh fake home. Only these variables were set:

env -i PATH="$NODE24/bin:/usr/bin:/bin" HOME="$FAKE" TMPDIR="$FAKE/tmp" \
  XDG_CONFIG_HOME="$FAKE/.config" XDG_DATA_HOME="$FAKE/.local/share" \
  XDG_CACHE_HOME="$FAKE/.cache" XDG_STATE_HOME="$FAKE/.local/state" \
  npm_config_cache="$FAKE/.npm" npm_config_prefix="$FAKE/.npm-global" \
  npm_command=exec \
  timeout 60 node scripts/rea.mjs setup --client qwen_code --dry-run --format json

npm_command=exec is what npx sets. With it, setup writes the pinned npx entry. Without it, setup writes the local scripts/rea.mjs path.

node scripts/rea.mjs setup --all-detected --dry-run --format json
node scripts/rea.mjs setup --client qwen_code --dry-run --format json
node scripts/rea.mjs setup --client qwen_code --format json
node scripts/rea.mjs setup --client qwen_code --yes --format json
node scripts/rea.mjs doctor --client qwen_code --skill --format json
node scripts/rea.mjs uninstall --format json
QWEN_HOME="$FAKE/qhome" node scripts/rea.mjs setup --client qwen_code --dry-run --format json
mkfifo ~/.qwen/settings.json   # then the four commands under timeout 20
npx vitest run --project boundary \
  tests/boundary/filesystem/qwenClientConfiguration.test.ts \
  tests/boundary/filesystem/clientLifecycle.test.ts
Test setup
  • Box: Nobara 44 (Fedora 44 base), Linux 7.2.9
  • CPU: AMD Ryzen 9 5900X, 12 cores / 24 threads
  • RAM: 32 GB DDR4-3600
  • Node: 22.23.1, 24.18.0, 26.11.1
  • Head / base: ad8f357f / 499e2f54
  • Other: npm 11.16.0, Qwen Code source at v0.25.0

🤖 Generated with Claude Code (Opus 5.5) 🦊

@morluto

morluto commented Oct 10, 2026

Copy link
Copy Markdown
Owner

Hey thanks for this Yiliang! I wrote some code for qwen code a while back. It was a great experience

@N0zoM1z0

Copy link
Copy Markdown
Collaborator

Verified Qwen Code 0.25.0 against the merged implementation and a production-only installed REA tarball on Linux x64: plain chat, all 139 MCP tools discovered, native skill loading, deferred analysis call, Unicode target identity, and reading the complete offloaded Evidence through Qwen's shell tool all passed. Owned shutdown was clean. Repeatable checks: #1511. Loopback model only; live provider/Windows and default OS-home skill discovery are not claimed.

@yiliang114

Copy link
Copy Markdown
Contributor Author

@morluto @CassieFox23 @N0zoM1z0 thanks a lot for the careful review, thorough verification, and quick merge — really appreciate the help! 🙏

darsrc pushed a commit to darsrc/rea that referenced this pull request Oct 10, 2026
* feat(clients): register Qwen Code during setup

* fix(clients): honor Qwen home and shared skill discovery

---------

Co-authored-by: morluto <[email protected]>
@morluto morluto added enhancement New feature or request area: cli CLI adapter and one-shot commands labels Oct 14, 2026
@CassieFox23

Copy link
Copy Markdown
Contributor

TL;DR: Qwen Code 0.25.1 connects to REA through the setup entry. The saved npx command starts REA 6.5.0 and lists 207 tools. npm run check and docs:check pass on main. The full npm test and Windows and macOS are still not run.

This pull request merged as aa23ec8 (#1415) on 2026-10-10. This comment is a record. It runs the items from my first comment that I had not run. I ran them on main at 40f73f6 (#3735). Every run used a fresh fake home, as before.

What ran

Check Result
setup --client qwen_code --yes on main Exit 0. It wrote rea as npx -y [email protected] mcp.
That saved npx command, driven over stdio Exit 0. The server says rea 6.5.0. It lists 207 tools.
Qwen Code 0.25.1, qwen --version Exit 0, prints 0.25.1.
qwen mcp list Exit 0. It shows rea: npx -y [email protected] mcp (stdio) - Connected.
npm run check Exit 0.
npm run docs:check Exit 0. The README test passes, 5 of 5.

I installed Qwen Code (Apache-2.0) 0.25.1 from npm into the fake home. I did not start a chat, and I set no model. So this shows Qwen Code reads the setup entry and reaches REA. It does not show a tool call from Qwen Code. N0zoM1z0 tested that in a comment on this pull request, on 0.25.0 with a model on loopback. I did not repeat it.

The npx command pulls the published rea-agents 6.5.0 from npm. Main's package says 6.5.0 too. I did not compare the two builds byte for byte.

npm run check ran the type check, oxlint, the format check, knip, the metadata check and two repo guards. Turbo replayed two of the six tasks from its cache. So I also ran each piece alone. All exit 0.

One change from my first test: on main, setup put the skill in ~/.agents/skills/reverse-engineer-anything. It no longer wrote ~/.qwen/skills. I only saw this. I did not look for the commit.

Not run

  • The full npm test. This box forbids whole suites.
  • A chat or a tool call through Qwen Code.
  • Windows and macOS.

Thanks, yiliang114, for the PR.

Commands
env -i PATH="$NODE24/bin:/usr/bin:/bin" HOME="$FAKE" TMPDIR="$FAKE/tmp" \
  XDG_CONFIG_HOME="$FAKE/.config" XDG_DATA_HOME="$FAKE/.local/share" \
  XDG_CACHE_HOME="$FAKE/.cache" XDG_STATE_HOME="$FAKE/.local/state" \
  npm_config_cache="$FAKE/.npm" npm_config_prefix="$FAKE/.npm-global" \
  npm_command=exec \
  node scripts/rea.mjs setup --client qwen_code --yes --format json

# stdio client: initialize, then tools/list
npx -y [email protected] mcp

npm install -g @qwen-code/[email protected]    # prefix inside the fake home
qwen --version
qwen mcp list                                 # from a project folder in the fake home

npm run check
npm run docs:check

The stdio client is a 30-line script of mine. It is not in the repo.

Test setup

🤖 Generated with Claude Code (Sonnet 5.5, verified by Opus 5.5) 🦊

@morluto morluto added the area: setup Setup, packaging, upgrade, install, Doctor, and client registration label Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli CLI adapter and one-shot commands area: setup Setup, packaging, upgrade, install, Doctor, and client registration enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Support Qwen Code in rea setup client integrations

4 participants