-
Notifications
You must be signed in to change notification settings - Fork 3k
fix(config): allow prompt hooks in settings schema #8779
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
069e54e
5737e55
4c0ff74
d125a98
cfa2f9d
09ac86c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -202,7 +202,7 @@ const HOOK_DEFINITION_ITEMS: SettingItemDefinition = { | |||||||||||||||||||||
| type: 'string', | ||||||||||||||||||||||
| description: | ||||||||||||||||||||||
| 'The type of hook. Note: "function" type is only available via SDK registration, not settings.json.', | ||||||||||||||||||||||
| enum: ['command', 'http'], | ||||||||||||||||||||||
| enum: ['command', 'http', 'prompt'], | ||||||||||||||||||||||
| required: true, | ||||||||||||||||||||||
| }, | ||||||||||||||||||||||
| command: { | ||||||||||||||||||||||
|
|
@@ -215,6 +215,15 @@ const HOOK_DEFINITION_ITEMS: SettingItemDefinition = { | |||||||||||||||||||||
| description: | ||||||||||||||||||||||
| 'The URL to send the POST request to. Required for "http" type.', | ||||||||||||||||||||||
| }, | ||||||||||||||||||||||
| prompt: { | ||||||||||||||||||||||
| type: 'string', | ||||||||||||||||||||||
| description: | ||||||||||||||||||||||
| 'The prompt to send to the model. Required for "prompt" type.', | ||||||||||||||||||||||
| }, | ||||||||||||||||||||||
|
Comment on lines
+218
to
+222
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Suggestion] The restored field descriptions are paraphrases of the #3388 originals rather than verbatim restorations, dropping two documented user-facing details: the
Suggested change
Also restore the adjacent 中文说明恢复的字段描述是对 #3388 原始文本的改写而非逐字恢复,丢失了两处已文档化的用户可见信息: — qwen3.8-max via Qwen Code /review (v0.21.8)
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks — this is a valid documentation improvement, but it is not changed by This maintenance commit is intentionally limited to the Critical build blocker. The maintainer's exact-head verification found the schema restoration correct and complete and identified the test compilation failure as the only merge blocker. Changing the source descriptions and regenerating the schema here would widen the already verified diff. I am therefore leaving this Suggestion explicitly unresolved and deferred for a separate maintainer decision or follow-up; I am not claiming it as fixed. 中文说明感谢指出,这是一项有效的文档改进建议,但 本次维护提交刻意只处理阻塞构建的 Critical。维护者已在精确 head 上确认 schema 恢复正确且完整,并认定测试编译失败是唯一合并阻塞项。此时再修改源码描述并重新生成 schema,会扩大已经完成验证的差异范围。 因此这条 Suggestion 会明确保持未解决并 defer,留给维护者单独决定或后续处理;这里不会把它声称为已修复。 |
||||||||||||||||||||||
| model: { | ||||||||||||||||||||||
| type: 'string', | ||||||||||||||||||||||
| description: 'The optional model to use for a "prompt" hook.', | ||||||||||||||||||||||
| }, | ||||||||||||||||||||||
| headers: { | ||||||||||||||||||||||
| type: 'object', | ||||||||||||||||||||||
| description: | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Suggestion] The hook-type allowlist widened here is duplicated in the ACP settings-read mirror —
QwenHookConfiginpackages/cli/src/acp-integration/acpAgent.tsdeclarestype: 'command' | 'http'andnormalizeHookConfigthrows'Hook type must be command or http'— and in the desktop DTO/UI (packages/desktop/packages/shared/src/protocol/dto.ts,QwenSettingsPage.tsx). This change makes those lists diverge on a config the schema now blesses. — Concrete cost: with{"hooks": {"PreToolUse": [{"hooks": [{"type": "prompt", "prompt": "..."}]}]}}in settings.json (schema-valid after this PR), the ACP settings-read path (readHooks→normalizeHookDefinition→normalizeHookConfig) throws for that entry;readHookscatches it and skips it with only adebugLogger.warn("Skipping malformed hook entry"). Result: a valid prompt hook is silently invisible in the IDE-side user/workspace/merged hook listings served byqwen/settings/getCore, and the desktop DTO/UI cannot represent it — the same "valid config rejected" class this PR fixes for the schema, surviving in the mirrors. Before this PR the editor flagged such configs too, so the divergence is newly introduced by this diff. Either extend the mirrors in this PR as well (QwenHookConfigtype +normalizeHookConfigacceptance with aprompt/modelbranch, plus the desktop DTO/UI), or file a follow-up issue and reference it here so the divergence is a decision, not an accident.中文说明
此处放宽的 hook 类型白名单在 ACP 设置读取侧存在镜像副本——
packages/cli/src/acp-integration/acpAgent.ts中的QwenHookConfig声明type: 'command' | 'http',且normalizeHookConfig会抛出'Hook type must be command or http'——desktop 的 DTO/UI(packages/desktop/packages/shared/src/protocol/dto.ts、QwenSettingsPage.tsx)中同样如此。本次改动使这些列表对 schema 现已接受的配置产生分歧。——具体代价:settings.json 中配置{"hooks": {"PreToolUse": [{"hooks": [{"type": "prompt", "prompt": "..."}]}]}}(本 PR 之后 schema 校验通过)时,ACP 设置读取路径(readHooks→normalizeHookDefinition→normalizeHookConfig)会抛错;readHooks捕获后仅以debugLogger.warn("Skipping malformed hook entry")跳过该条目。结果:有效的 prompt hook 在qwen/settings/getCore提供的 IDE 侧 user/workspace/merged hook 列表中静默不可见,desktop 的 DTO/UI 也无法表示它——这正是本 PR 为 schema 修复的"有效配置被拒绝"同类问题,在镜像副本中依然存在。本 PR 之前编辑器同样会标记此类配置,因此该分歧是本次 diff 新引入的。建议在本 PR 中一并扩展镜像副本(QwenHookConfig类型 +normalizeHookConfig的接受逻辑及prompt/model分支,加上 desktop 的 DTO/UI),或者创建一个后续 issue 并在本 PR 中注明,使该分歧成为有意决策而非意外遗漏。— qwen3.8-max via Qwen Code /review (v0.21.8)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks — the cross-consumer divergence is valid, but
d125a98935d1e5833639d17a1f7a01a03a611901does not address it.Supporting prompt hooks in the ACP normalizer and desktop DTO/UI is a separate cross-package behavioral expansion, with downstream consumers and regression tests beyond the schema-test compilation blocker maintained in this pass. Adding it here would materially widen the PR.
I am explicitly deferring this Suggestion and leaving it unresolved rather than claiming it is fixed. No follow-up issue was created in this maintenance pass.
中文说明
感谢指出,跨消费端的不一致确实存在,但
d125a98935d1e5833639d17a1f7a01a03a611901没有处理它。让 ACP normalizer 与 desktop DTO/UI 支持 prompt hook 是一项独立的跨 package 行为扩展,涉及本次 schema 测试编译阻塞之外的下游消费者与回归测试。把它加入当前修复会实质扩大 PR 范围。
因此这里明确 defer 这条 Suggestion,并保持未解决,不会声称已修复。本次维护没有创建后续 issue。