Repository navigation
feat(hooks): support preserveUnownedHooks for Qwen Code - #3509
Merged
Merged
Conversation
Qwen Code hook generation replaced every existing handler in `.qwen/settings.json` even with `preserveUnownedHooks: true`. Wire the adapter into the shared ownership lock and preservation helper, as Claude Code, Codex CLI and Cursor already do, and emit the lock next to the settings file. A preserved matcher group now joins a generated group only when its group-level keys other than `matcher` and `hooks` agree, so a foreign `sequential` group is kept as its own group instead of losing (or gaining) sequential execution. Closes #3496 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012y9fNo2AAJdGocxvsHtDhv
… in preserveUnownedHooks Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012y9fNo2AAJdGocxvsHtDhv
…encode-preserve-hooks # Conflicts: # docs/reference/file-formats.md # src/generated/docs-content.ts
dyoshikawa
added a commit
that referenced
this pull request
Oct 17, 2026
…dex-hook-positions Resolve the conflict with the Qwen Code preservation change (#3509): a generated handler is updated in place, and a new one joins an existing group, only when the group's matcher and group-level keys (such as `sequential`) match its own. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012y9fNo2AAJdGocxvsHtDhv
This was referenced Oct 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Qwen Code hook generation merged
.qwen/settings.jsoncorrectly for unrelated settings, but replaced every existing hook handler even with"preserveUnownedHooks": true— the adapter never consumedpreserveUnownedand inheritedsupportsPreserveUnowned() === false.QwencodeHooksnow uses the shared ownership lock andmergeGeneratedHookListshelper (matcher-group shape), like Claude Code, Codex CLI and Cursor. It reads.qwen/.rulesync-hooks-lock.json(~/.qwen/...in global scope) and emits it as an auxiliary file only when preservation is on.sequentialkeeps its meaning: the preservation helper now folds a preserved matcher group into an existing one only when its group-level keys other thanmatcherandhooksagree. A foreign{ matcher: "Bash", sequential: true }group is therefore kept as its own group next to the generated{ matcher: "Bash" }group, instead of losing sequential execution (or making the generated group's handlers sequential). For the other adapters, generated groups carry onlymatcherandhooks, so their behavior is unchanged unless a foreign group has extra group-level keys (e.g. a Factory Droid-stylecommandRegex), which are now preserved rather than dropped on merge.docs/guide/configuration.mdanddocs/reference/file-formats.mdlist Qwen Code among the supported targets.Tests
qwencode-hooks.test.ts: unrelated settings preserved, foreign sequential handler kept as its own group, lock contents, retraction of a formerly generated handler with an intact lock, idempotency across two runs, and default replacement (no lock) when preservation is off.preserve-unowned-hook-commands.test.ts: groups with differing group-level keys are not merged, in both directions.Closes #3496
🤖 Generated with Claude Code
https://claude.ai/code/session_012y9fNo2AAJdGocxvsHtDhv