Skip to content

feat: add Qoder CLI (qodercli/qoderclicn) agents and supervised-hook registration for Qwen Code - #12910

Closed
jyang2004 wants to merge 1 commit into
stablyai:mainfrom
jyang2004:feat/qoder-qwen-supervised-agents
Closed

jyang2004 wants to merge 1 commit into
stablyai:mainfrom
jyang2004:feat/qoder-qwen-supervised-agents

Conversation

@jyang2004

Copy link
Copy Markdown

Summary

Fixes #12738 · refs #12279, #7480

Orca could launch Qwen Code and assign tasks to it manually, but orchestrator-driven supervised dispatch failed because qwen-code has a TuiAgent registration yet no managed hook service (the "supervised-agent registration"). Qoder CLI — Alibaba's other coding CLI, in both its builds (qodercli international, qoderclicn CN) — was missing from both layers entirely.

This PR:

  1. Adds a qwen-code managed hook service, so the already-launchable agent becomes supervisable (orchestration worker-start --agent qwen-code can register and track it).
  2. Registers qodercli and qoderclicn as first-class agents in both layers: the TuiAgent wiring (launch/detect/catalog/icons/permissions/telemetry/mobile) and managed hook services, so both Qoder builds are launchable and supervisable.

Implementation notes

  • Both Qoder builds are Claude Code-compatible: qoderclicn ships a hooks migrate --from-claude command and reads hooks from ~/.qoder-cn/settings.json; the international build uses ~/.qoder-cli. So their hook services are thin ClaudeHookService instantiations — the same pattern as OpenClaude (src/main/openclaude/hook-service.ts) — and hook payloads reuse the existing /hook/claude endpoint and parser, with pane attribution via paneKey (unchanged).
  • Qwen Code documents a Claude-shaped hooks schema (~/.qwen/settings.json, command hooks with matcher) in docs/users/features/hooks.md, so it also rides the Claude-compatible installer — but with its documented event subset (SessionStart, UserPromptSubmit, Stop, SubagentStart, SubagentStop, Pre/PostToolUse, PostToolUseFailure, PermissionRequest) instead of the full list containing the OpenClaude-specific StopFailure/TeammateIdle names. ClaudeCompatibleHookSettings gained an optional events override for this; default behavior for Claude/OpenClaude is unchanged.
  • New services are registered in MANAGED_AGENT_HOOK_* and REMOTE_MANAGED_HOOK_INSTALLERS (they inherit installRemote, so the issue [Bug]: Codex, Amp & Droid agent status not shown in task tree over SSH remote (works locally; Claude/Hermes OK over SSH) #7253 guard test requires the remote registration), plus the servicesByAgent map in remote-hook-service-installers.test.ts.
  • config/tsconfig.cli.json lists hook services explicitly, so the three new files are added to its include.
  • Catalog label note: the CN entry is labeled Qoder CLI China rather than Qoder CLI CN because a trailing CN word contains the substring cn — Continue's catalog command — and agent-picker-search.test.ts guards exactly that ranking-collision class.
  • Skills CLI keys map to the community CLI's existing qoder / qoder-cn keys.
  • Qoder icons are the official logo (qoder.com), resized to the 64×64 convention.

Test plan

  • pnpm typecheck — clean (node, tc.cli, tc.web projects)
  • npx vitest run src/main/agent-hooks src/main/claude src/shared — all pass (incl. updated managed-hook-local-filesystem.test.ts agent count 14 → 17)
  • npx vitest run --config config/vitest.config.ts src/renderer/src/lib — all pass
  • pnpm verify:localization-catalog / verify:localization-extraction — clean after sync:localization-catalog (en.json entries added; other locales fall back)
  • Manual smoke: qoderclicn 1.1.15 installed locally; verified config root ~/.qoder-cn and Claude-compatible hooks schema. Maintainer may want to run a supervised worker-start --agent qoderclicn end-to-end before merge.

…registration for Qwen Code

Layer 1 (launch/detect): register qodercli and qoderclicn as TuiAgents —
types, launch config, display names, telemetry kinds, permissions
(--dangerously-skip-permissions, Claude-derived CLI), agent selection,
skills keys (qoder/qoder-cn), catalog entries, favicon assets, status,
mobile maps, icons, README badges.

Layer 2 (supervised-agent registration): add managed hook services for
qwen-code, qodercli, qoderclicn via the Claude-compatible hook installer
(reuses the /hook/claude payload path, as OpenClaude does). Qwen Code gets
its documented event subset; Qoder variants use the full Claude event set.
Wired into local + remote (SSH) installer registries and guard tests.

Fixes the orchestrator dispatch failure where Qwen Code could be manually
assigned but not supervised, and makes both Qoder CLI builds assignable.

Refs stablyai#12738
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The change adds qodercli and qoderclicn as supported TUI agents. It adds executable configuration, permissions, selection, telemetry, Skills CLI mappings, renderer catalog entries, favicon assets, mobile mappings, localized labels, and documentation. It extends Claude-compatible hook settings with agent-specific events and adds hook services for Qoder CLI variants and Qwen Code. Local and remote hook registries and related tests include the new services.

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (2 warnings, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the feature and test plan, but it omits the required Screenshots, AI Review Report, Security Audit, and Notes sections. Add the missing template sections, state "No visual change" if applicable, and document AI cross-platform review, security checks, and platform-specific risks.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Linked Issues check ❓ Inconclusive The PR satisfies [#12738] objectives for agent wiring and supervised registration, but the required PNG icon files are excluded from review and cannot be verified. Review src/shared/agent-icons/qodercli.png and qoderclicn.png, excluded by !**/*.png, to verify the required icon assets.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the Qoder CLI agent additions and Qwen Code supervised-hook registration.
Out of Scope Changes check ✅ Passed The changes support the linked issue objectives, including Qwen Code registration, both Qoder variants, shared hook behavior, tests, and related UI configuration.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6c3568b6-52ba-440f-9193-afb020469fdb

📥 Commits

Reviewing files that changed from the base of the PR and between f713739 and 5cd422e.

⛔ Files ignored due to path filters (2)
  • src/shared/agent-icons/qodercli.png is excluded by !**/*.png
  • src/shared/agent-icons/qoderclicn.png is excluded by !**/*.png
📒 Files selected for processing (26)
  • README.md
  • config/tsconfig.cli.json
  • mobile/src/components/mobile-agent-icon-assets.ts
  • mobile/src/tasks/mobile-tui-agents.ts
  • src/main/agent-hooks/managed-agent-hook-registry.ts
  • src/main/agent-hooks/managed-hook-local-filesystem.test.ts
  • src/main/agent-hooks/remote-hook-service-installers.test.ts
  • src/main/agent-hooks/remote-managed-hook-installers.ts
  • src/main/claude/hook-service.ts
  • src/main/claude/hook-settings.ts
  • src/main/qodercli/hook-service.ts
  • src/main/qoderclicn/hook-service.ts
  • src/main/qwen-code/hook-service.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/lib/agent-catalog.tsx
  • src/renderer/src/lib/agent-favicon-assets.ts
  • src/renderer/src/lib/agent-status.ts
  • src/shared/agent-hook-types.ts
  • src/shared/agent-kind.ts
  • src/shared/skills-cli-agent-keys.ts
  • src/shared/telemetry-events.ts
  • src/shared/tui-agent-config.ts
  • src/shared/tui-agent-display-names.ts
  • src/shared/tui-agent-permissions.ts
  • src/shared/tui-agent-selection.ts
  • src/shared/types.ts

Comment on lines +76 to +79
export const QODERCLI_HOOK_SETTINGS: ClaudeCompatibleHookSettings = {
configDirName: '.qoder-cli',
scriptBaseName: 'qodercli-hook'
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Repository files matching hook-settings.ts:"
fd -a 'hook-settings\.ts$' . || true

echo
echo "Relevant file contents:"
file="$(fd 'hook-settings\.ts$' . | head -n1 || true)"
if [ -n "${file:-}" ]; then
  wc -l "$file"
  cat -n "$file"
fi

echo
echo "Search for QODERCLI_HOOK_SETTINGS and config path/usages:"
rg -n "QODERCLI_HOOK_SETTINGS|getConfigPath|configDirName|scriptBaseName|\.qoder|\.qoder-cli|settings\.json|hook-settings" .

Repository: stablyai/orca

Length of output: 38010


🌐 Web query:

Qoder CLI user hooks settings.json ~/.qoder settings.json

💡 Result:

In Qoder CLI, user hooks are configured within the ~/.qoder/settings.json file [1][2][3]. This file serves as the user-level configuration, applying your hook definitions across all projects [1][4][3]. To configure hooks, add a hooks object to your ~/.qoder/settings.json file [1][3]. The configuration structure allows you to define hooks for specific events (e.g., PreToolUse, PostToolUse) [1][5][3]: { "hooks": { "EventName": [ { "matcher": "match condition", "hooks": [ { "type": "command", "command": "path/to/script.sh", "timeout": 600 } ] } ] } } Key configuration details: - Hook sources: Qoder loads and merges hooks from three sources: the user-level file (~/.qoder/settings.json), the project-level file (${project}/.qoder/settings.json), and the project-local file (${project}/.qoder/settings.local.json) [1][2][3]. - Configuration Scope: The user-level ~/.qoder/settings.json is best for personal preferences that apply globally [4][3]. Project-level files are better for team-shared conventions, while .settings.local.json is recommended for private, machine-specific overrides (and should be added to .gitignore) [1][4][3]. - Execution: Hooks can be triggered by events like PreToolUse. The matcher field uses regex to determine which tool calls trigger the hook; if omitted, the hook fires for every occurrence of that event [1][5][3]. - Customization: You can change the base configuration directory (~/.qoder) by setting the QODER_CONFIG_DIR environment variable [4][6]. For more details on hook event types and definitions, refer to the official Qoder documentation [1][2][5].

Citations:


🌐 Web query:

docs.qoder.com extensions hooks settings.json

💡 Result:

Qoder CLI uses hooks to allow you to intercept specific lifecycle events during task execution [1][2]. Configuration for these hooks is primarily managed through settings.json files [1][3]. Configuration Locations Hook configurations are loaded and merged from three primary files [1][2]: 1. User-level: ~/.qoder/settings.json (Applies to all projects) [3][4] 2. Project-level: ${project}/.qoder/settings.json (Applies to the current project; intended to be committed to version control for team sharing) [3][4] 3. Project-level (local): ${project}/.qoder/settings.local.json (Applies to the current project on your local machine; recommended to be added to.gitignore) [3][4] Configuration Format Hooks are defined within the hooks object in your settings.json [1][3]. Each event (e.g., PreToolUse) contains a list of matcher objects [1][2]: { "hooks": { "PreToolUse": [ { "matcher": "Bash", "hooks": [ { "type": "command", "command": "~/.qoder/hooks/block-rm.sh" } ] } ] } } Key Configuration Fields - type: Must be "command" [3]. - command: The shell command or path to the script to execute [3]. - matcher: (Optional) A regex pattern to filter when the hook fires (e.g., "Bash" or a specific tool name) [1][3]. If omitted, the hook fires on every occurrence of the event [3]. - timeout: (Optional) Timeout in seconds (defaults to 30) [3]. Plugin Hooks Plugins can also declare their own hooks using a hooks/hooks.json file [5][6]. Unlike settings.json, which uses a bare hooks field, a plugin's hooks/hooks.json requires a top-level hooks wrapper: { "hooks": { "EventName": [... ] } } For developers using the Qoder SDK (TypeScript or Python), hooks can also be configured programmatically within the agent's options (e.g., QueryOptions.hooks or QoderAgentOptions.hooks) [7][8].

Citations:


Use Qoder’s documented settings path.

QODERCLI_HOOK_SETTINGS writes to ~/.qoder-cli/settings.json, but Qoder reads user hooks from ~/.qoder/settings.json, so managed hooks will not be loaded. Change configDirName to .qoder.


🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== files =="
git ls-files | rg '(^|/)hook-settings\.ts$|readme|docs|extension|cli|qoder|claude' || true

echo "== target outline =="
ast-grep outline src/main/claude/hook-settings.ts --view expanded || true

echo "== target excerpt =="
cat -n src/main/claude/hook-settings.ts | sed -n '1,140p'

echo "== search events in hook settings =="
rg -n "CLAUDE_EVENTS|QODERCLI|OpenClaude|StopFailure|TeammateIdle|hooks|extensions/hooks|events" .

Repository: stablyai/orca

Length of output: 50372


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== exact target file =="
sed -n '1,120p' src/main/claude/hook-settings.ts

echo "== hook settings file count =="
git ls-files | rg '(^|/)hook-settings\.ts$' || true

echo "== QODERCLI settings uses =="
rg -n "QODERCLI_HOOK_SETTINGS|CLAUDE_HOOK_SETTINGS|ClaudeCompatibleHookSettings|events:" src/main src/shared src/renderer src/main -g '*.ts' -g '*.tsx' || true

echo "== docs qoder hook event mentions in repo =="
rg -n --fixed-strings "docs.qoder.com/extensions/hooks|qoder-cli|qoder.cn|qoder.cn" . || true

Repository: stablyai/orca

Length of output: 50370


🌐 Web query:

docs.qoder.com/extensions/hooks stopfailure teammateidle events qoder-cli qoder-cn

💡 Result:

In the context of Qoder CLI, StopFailure and TeammateIdle are specific events utilized within the Qoder hook system to manage agent behavior and handle errors [1][2][3]. StopFailure The StopFailure event is triggered when the Qoder Agent stops unexpectedly due to an error [1][2]. It is a notification-only event, meaning that any output or exit code provided by a hook in response to this event is ignored [1][2]. - Matcher field: The event can be matched using the error_type field [1][2]. - Input fields: It provides information via error_type, error, error_details, and last_assistant_message [1][2]. - Recognized error_type values include: rate_limit, authentication_failed, billing_error, invalid_request, server_error, max_output_tokens, and unknown [1][2]. TeammateIdle TeammateIdle is an event identified within the Qoder hook and Pro Workflow ecosystems [3][4][5]. While the official Qoder documentation focuses on the lifecycle hooks, TeammateIdle is recognized as one of the events used to trigger automated scripts (such as those found in the pro-workflow repository) to manage agent states or perform tasks when an agent remains idle [3][4]. Hook System Context Qoder CLI provides a robust hook system that allows developers to intercept and modify agent behavior across various stages of a session [1][6]. The system uses JavaScript regex matchers for hooks and supports controllable behaviors (such as blocking execution) for specific events [6]. While StopFailure is a standard event for error notification, TeammateIdle acts as an event trigger for orchestration or automation scripts [1][3].

Citations:


🌐 Web query:

site:docs.qoder.com/cli/hooks Qoder CLI events list

💡 Result:

The Qoder CLI does not have a single command specifically named "events list" to display events. Instead, events are used within the Qoder CLI "Hooks" system to intercept the agent's execution flow at specific points [1][2]. You can view the full list of supported events in the official Qoder documentation under the Hooks section [1][2]. These events are categorized by their purpose and include details such as their matcher, blocking support (via exit code 2), and associated input fields [1]. Commonly used events include: - SessionStart and SessionEnd - UserPromptSubmit - PreToolUse and PostToolUse - PermissionRequest and PermissionDenied - SubagentStart and SubagentStop - FileChanged, CwdChanged, and ConfigChange Hooks are configured via JSON files, allowing you to define actions that trigger when these specific events occur, such as blocking operations, sending notifications, or running external commands [2].

Citations:


🌐 Web query:

site:docs.qoder.com/cli/hooks PostToolUseFailure StopFailure TeammateIdle Stop Qoder CLI

💡 Result:

In the Qoder CLI, PostToolUseFailure, StopFailure, and Stop are specific event hooks used to intercept the agent's execution flow [1][2]. These hooks are defined via JSON configuration files and allow for external scripts or commands to run in response to specific lifecycle events [2]. PostToolUseFailure: This event is triggered when a tool execution fails [1]. It provides context including the tool_name, the error encountered, and the error_type (e.g., execution_failed) [1]. StopFailure: This event is triggered when the agent stops unexpectedly due to an error, such as a rate_limit, server_error, or authentication_failed [1]. It is intended for notification purposes; output and exit codes from hooks triggered by this event are ignored by the CLI [1]. Stop: This event is triggered when the agent reaches a stop state [1]. Unlike the failure-specific hooks, this event allows blocking the flow if the hook exits with code 2 [1]. Regarding TeammateIdle: There is no documented event or hook named TeammateIdle in the Qoder CLI documentation provided [1][2]. It is possible this term is not part of the standard Qoder hook system [1][2].

Citations:


Define Qoder-specific hook event lists.

QODERCLI_HOOK_SETTINGS and QODERCLICN_HOOK_SETTINGS still omit events, so both assignments use CLAUDE_EVENTS. Assign shared lists that include documented Qoder events but exclude TeammateIdle, which Qoder docs do not document. Include StopFailure/PostToolUseFailure only if Qoder CLI supports them.

@nwparker

Copy link
Copy Markdown
Contributor

Cross-reviewed this proposal while consolidating Qoder support in #23581.

The consolidated change reuses the compatible installer/event-subset approach and remote hook wiring. Qoder 1.1.64 was observed using ~/.qoder/settings.json; it gets its own /hook/qoder source. Qwen and qoderclicn remain outside this PR, so this does not replace that portion of your proposal.

Your contribution is credited with a Co-authored-by trailer in f2b5c1c and linked in the PR comparison table. Live macOS verification includes Qoder identity and the left-sidebar failure state; successful model/tool execution remains unverified because the available account has exhausted its credits.

nwparker added a commit that referenced this pull request Sep 28, 2026
feat: add first-class Qoder CLI support

Integrate Qoder launch, identity, canonical hook status, trust and resume.
Verify with captured Qoder 1.1.64 transcripts and hidden Electron sidebar checks.

Builds on and cross-reviews #7502, #8611, #9655, #12910, #13311 and #15291.

Co-authored-by: dalveytech-vincent <[email protected]>
Co-authored-by: Eridanus117 <[email protected]>
Co-authored-by: xingqingzzp-gif <[email protected]>
Co-authored-by: jyang2004 <[email protected]>
Co-authored-by: yunqian <[email protected]>
Co-authored-by: huzhening.hzn <[email protected]>
@nwparker

Copy link
Copy Markdown
Contributor

International Qoder support is now merged in #23581, using agent ID qoder and the verified qodercli binary. This proposal was cross-reviewed and its author is credited as a co-author in the merged commit. Keeping this PR open because Qwen supervised registration and qoderclicn support remain outside that implementation; those parts can continue separately. See #23581 for validation and live-Qoder limitations.

@nwparker

nwparker commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

The successor #24616 has now actually merged as843607b1bcc3e17782de2ee18b8dc3d3aecb1f6f. Thank you @jyang2004 for the original Qoder CN and Qwen supervised-hook registration work; contributor credit is preserved in the successor and source history. Current package flags, event contracts, host boundaries and integration tests were independently checked, with fresh hosted CI green. This original is already closed, so no further close action is needed. Broader authenticated China/Qwen task, completion and resume acceptance remain open in #12738/#16540.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Supervised-agent registration for Qwen Code + add Qoder CLI (qodercli / qoderclicn) as orchestratable agents

4 participants