Skip to content

hooks: HookCommand schema fields accepted but silently dropped by executors #286

Description

@LeXwDeX

发现(hooks 修复 PR #281 的后续审计)

src/hook/settings.tsHookCommand schema(~L131-198)接受若干字段,但执行器从不消费——配置合法却静默失效(与 #281 修复的 headers 丢弃同类问题):

字段 位置 现状
allowedEnvVars L147 全仓库零消费者
statusMessage L149 全仓库零消费者
once(hooks[] 内 per-command) L150 只消费 entry 级 _sessionEntry?.once(L2019/2094/2145);per-command once 从不读取,detectUnsupportedFields 也不报
timeout × type:"prompt" 头部文档 L22 承诺 command/mcp/http/agent 均应用(L1008/1417/1454/1604),唯 promptHandler(L1507-1558)无 Effect.timeout/abortSignal

已确认正常消费headers#281 修复)、timeout(4/5 型)、ifasync/asyncRewakeoptions(仅 command 型)、__sourceDir、url/prompt 回退。shell 丢弃但 load 时有 warn(L961-977)。

修复选项(任选其一并统一)

  1. 落地消费:prompt 型补 Effect.timeout;per-command once 接入 entry 级同款逻辑
  2. 显式拒绝detectUnsupportedFields 对静默字段报 warning
  3. schema 收缩:从 HookCommand 移除无消费意图的字段

影响

配置者的合理预期被静默违背(尤其 prompt-timeout 有文档承诺)。无安全面,故不在本次止血发布内。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions