Skip to content

fix(hooks): close Qwen Code hooks gaps (events, http, sequential/disableAllHooks) - #1951

Merged
dyoshikawa merged 1 commit into
mainfrom
resolve-scrap-issue-1925-qwen-hooks
Jun 19, 2026
Merged

fix(hooks): close Qwen Code hooks gaps (events, http, sequential/disableAllHooks)#1951
dyoshikawa merged 1 commit into
mainfrom
resolve-scrap-issue-1925-qwen-hooks

Conversation

@dyoshikawa

Copy link
Copy Markdown
Owner

Summary

Closes the three Qwen Code hooks gaps reported in #1925.

Issue: #1925
Ref: #1888

Changes

1. Missing events TodoCreated, TodoCompleted, StopFailure

  • Added canonical events todoCreated, todoCompleted, and stopFailure to the
    HookEvent union in src/types/hooks.ts.
  • Mapped them in QWENCODE_HOOK_EVENTS and CANONICAL_TO_QWENCODE_EVENT_NAMES
    (⇄ TodoCreated / TodoCompleted / StopFailure).
  • Safety: every other tool adapter filters config.hooks against its own
    *_HOOK_EVENTS set (supported.has(event)), and unknown event names fall
    back via ?? eventName. The new canonical events are therefore only emitted
    by Qwen Code; no other tool adapter changes behavior. Confirmed by reading the
    shared tool-hooks-converter.ts and the claudecode / copilotcli /
    copilot adapters, and by the full test suite passing.

2. http hook type was lossy on import

  • qwencodeHooksToCanonical previously coerced any non-command/prompt hook
    (including http) to command, dropping the transport. It now preserves
    http and its target url.
  • Added a url field to the canonical HookDefinitionSchema so the URL
    round-trips, and updated copilotcli-hooks.ts to keep passing url through
    for its http export now that url is a canonical (no longer passthrough) key.

3. Group-level sequential and top-level disableAllHooks not round-tripped

  • QwencodeMatcherEntrySchema now reads sequential (per matcher group), stored
    per canonical definition and re-emitted when any definition in a group opts in
    (Qwen defaults to parallel, so it is only written when true).
  • disableAllHooks is captured into the qwencode namespace on import and
    written back to .qwen/settings.json on export.

Tests

  • Extended qwencode-hooks.test.ts: generate + import round-trip for the three
    new events, http type/url preservation on import and export, and
    sequential / disableAllHooks round-trip.
  • Preserved the Tool × Feature happy-path e2e tests (e2e-hooks.spec.ts, 52
    passing).
  • Synchronized docs/reference/file-formats.md and the generated
    skills/rulesync/file-formats.md.

Verification

Full pnpm cicheck (code + content) is green: oxfmt, oxlint, tsgo typecheck,
6743 unit tests, skill-doc-sync, cspell (0 issues), secretlint.

🤖 Generated with Claude Code

…bleAllHooks)

Add the three Qwen-specific hook events as canonical events and preserve
the `http` transport plus the group-level `sequential` and top-level
`disableAllHooks` switches on both import and export.

- Add canonical `todoCreated`, `todoCompleted`, and `stopFailure` events and
  map them in `QWENCODE_HOOK_EVENTS` / `CANONICAL_TO_QWENCODE_EVENT_NAMES`.
  Other tool adapters filter `config.hooks` against their own supported-event
  set, so the new canonical events are only emitted by Qwen Code.
- Preserve the `http` hook type and its `url` field on import instead of
  collapsing every non-command/prompt hook to `command`. Add `url` to the
  canonical `HookDefinitionSchema`.
- Round-trip the per-matcher-group `sequential` flag (stored per definition)
  and the top-level `disableAllHooks` switch (under the `qwencode` namespace).
- Keep copilotcli's `http` url passthrough working now that `url` is canonical.
- Extend unit tests and synchronize docs/skills.

Closes #1925
Ref: #1888

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dyoshikawa
dyoshikawa merged commit ab6f009 into main Jun 19, 2026
9 checks passed
@dyoshikawa

Copy link
Copy Markdown
Owner Author

@dyoshikawa Thank you!

@dyoshikawa
dyoshikawa deleted the resolve-scrap-issue-1925-qwen-hooks branch June 19, 2026 08:20
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.

2 participants