Repository navigation
feat: add Qoder CLI (qodercli/qoderclicn) agents and supervised-hook registration for Qwen Code - #12910
feat: add Qoder CLI (qodercli/qoderclicn) agents and supervised-hook registration for Qwen Code#12910jyang2004 wants to merge 1 commit into
Conversation
…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
📝 WalkthroughWalkthroughThe change adds 🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (2 warnings, 1 inconclusive)
✅ Passed checks (2 passed)
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. Comment |
There was a problem hiding this comment.
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
⛔ Files ignored due to path filters (2)
src/shared/agent-icons/qodercli.pngis excluded by!**/*.pngsrc/shared/agent-icons/qoderclicn.pngis excluded by!**/*.png
📒 Files selected for processing (26)
README.mdconfig/tsconfig.cli.jsonmobile/src/components/mobile-agent-icon-assets.tsmobile/src/tasks/mobile-tui-agents.tssrc/main/agent-hooks/managed-agent-hook-registry.tssrc/main/agent-hooks/managed-hook-local-filesystem.test.tssrc/main/agent-hooks/remote-hook-service-installers.test.tssrc/main/agent-hooks/remote-managed-hook-installers.tssrc/main/claude/hook-service.tssrc/main/claude/hook-settings.tssrc/main/qodercli/hook-service.tssrc/main/qoderclicn/hook-service.tssrc/main/qwen-code/hook-service.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/lib/agent-catalog.tsxsrc/renderer/src/lib/agent-favicon-assets.tssrc/renderer/src/lib/agent-status.tssrc/shared/agent-hook-types.tssrc/shared/agent-kind.tssrc/shared/skills-cli-agent-keys.tssrc/shared/telemetry-events.tssrc/shared/tui-agent-config.tssrc/shared/tui-agent-display-names.tssrc/shared/tui-agent-permissions.tssrc/shared/tui-agent-selection.tssrc/shared/types.ts
| export const QODERCLI_HOOK_SETTINGS: ClaudeCompatibleHookSettings = { | ||
| configDirName: '.qoder-cli', | ||
| scriptBaseName: 'qodercli-hook' | ||
| } |
There was a problem hiding this comment.
🎯 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:
- 1: http://docs.qoder.com/en/cli/hooks
- 2: https://docs.qoder.com/cli/hooks
- 3: https://docs.qoder.com/extensions/hooks
- 4: https://docs.qoder.com/cli/qoder-directory
- 5: https://docs.qoder.com/cli/sdk/hooks
- 6: http://docs.qoder.com/cli/install
🌐 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:
- 1: http://docs.qoder.com/en/cli/hooks
- 2: https://docs.qoder.com/cli/hooks
- 3: https://docs.qoder.com/extensions/hooks
- 4: https://docs.qoder.com/cli/qoder-directory
- 5: https://docs.qoder.com/cli/plugins
- 6: http://docs.qoder.com/en/cli/plugins
- 7: https://docs.qoder.com/en/cli/sdk/hooks
- 8: https://docs.qoder.com/en/cli/sdk/python/hooks
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" . || trueRepository: 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:
- 1: http://docs.qoder.com/cli/hooks
- 2: http://docs.qoder.com/en/cli/hooks
- 3: https://github.com/rohitg00/pro-workflow
- 4: https://claudeers.com/pro-workflow
- 5: https://github.com/lgs/pro-workflow
- 6: http://docs.qoder.com/cli/sdk/hooks
🌐 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:
- 1: http://docs.qoder.com/cli/hooks
- 2: https://docs.qoder.com/cli/hooks
🌐 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:
- 1: http://docs.qoder.com/cli/hooks
- 2: https://docs.qoder.com/cli/hooks
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.
|
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 Your contribution is credited with a |
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]>
|
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. |
|
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. |
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-codehas aTuiAgentregistration yet no managed hook service (the "supervised-agent registration"). Qoder CLI — Alibaba's other coding CLI, in both its builds (qodercliinternational,qoderclicnCN) — was missing from both layers entirely.This PR:
qwen-codemanaged hook service, so the already-launchable agent becomes supervisable (orchestrationworker-start --agent qwen-codecan register and track it).qodercliandqoderclicnas first-class agents in both layers: theTuiAgentwiring (launch/detect/catalog/icons/permissions/telemetry/mobile) and managed hook services, so both Qoder builds are launchable and supervisable.Implementation notes
qoderclicnships ahooks migrate --from-claudecommand and reads hooks from~/.qoder-cn/settings.json; the international build uses~/.qoder-cli. So their hook services are thinClaudeHookServiceinstantiations — the same pattern as OpenClaude (src/main/openclaude/hook-service.ts) — and hook payloads reuse the existing/hook/claudeendpoint and parser, with pane attribution viapaneKey(unchanged).~/.qwen/settings.json,commandhooks withmatcher) 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-specificStopFailure/TeammateIdlenames.ClaudeCompatibleHookSettingsgained an optionaleventsoverride for this; default behavior for Claude/OpenClaude is unchanged.MANAGED_AGENT_HOOK_*andREMOTE_MANAGED_HOOK_INSTALLERS(they inheritinstallRemote, 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 theservicesByAgentmap inremote-hook-service-installers.test.ts.config/tsconfig.cli.jsonlists hook services explicitly, so the three new files are added to itsinclude.Qoder CLI Chinarather thanQoder CLI CNbecause a trailingCNword contains the substringcn— Continue's catalog command — andagent-picker-search.test.tsguards exactly that ranking-collision class.qoder/qoder-cnkeys.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. updatedmanaged-hook-local-filesystem.test.tsagent count 14 → 17)npx vitest run --config config/vitest.config.ts src/renderer/src/lib— all passpnpm verify:localization-catalog/verify:localization-extraction— clean aftersync:localization-catalog(en.json entries added; other locales fall back)qoderclicn1.1.15 installed locally; verified config root~/.qoder-cnand Claude-compatible hooks schema. Maintainer may want to run a supervisedworker-start --agent qoderclicnend-to-end before merge.