Skip to content

fix(hook): apply prompt-hook timeout, surface dropped HookCommand fields - #288

Merged
LeXwDeX merged 1 commit into
devfrom
fix/hook-field-drift
Aug 15, 2026
Merged

fix(hook): apply prompt-hook timeout, surface dropped HookCommand fields#288
LeXwDeX merged 1 commit into
devfrom
fix/hook-field-drift

Conversation

@LeXwDeX

@LeXwDeX LeXwDeX commented Aug 15, 2026

Copy link
Copy Markdown
Owner

修复 issue #286(HookCommand schema 接受但执行器静默丢弃的字段)。

Fix

  1. prompt-timeout 落地promptHandlerEffect.timeout(entry.timeout ? entry.timeout*1000 : DEFAULT_TIMEOUT_MS)——头部文档承诺所有 hook 类型都支持 timeout,此前唯 prompt 型未执行;超时经 Effect.exit 捕获后降级为既有非阻塞 warn。
  2. 静默丢弃字段显式告警detectUnsupportedFields 追加 allowedEnvVars/statusMessage/per-command once(全仓库零消费者;entry 级 once 才有效)——配置者得到 warn 而非静默 no-op。timeout 不列入(已完整落地)。

Evidence(/tdd)

  • 红测先行:test/hook/warn-unsupported.test.ts 新增 flagging 用例(先 fail 后绿)
  • bun test test/hook 146 pass / 0 fail;typecheck 干净
  • 双轴自检(/code-review 纪律):无 any、沿用既有 timeout 成语式、真实函数无 mock

issue #286 — HookCommand schema accepted fields that every executor dropped:
- promptHandler now applies entry.timeout (same idiom as command/mcp/http;
  the header doc promised timeout for every hook type but prompt was the only
  executor never enforcing it — expiry degrades to the existing non-blocking warn)
- detectUnsupportedFields now flags allowedEnvVars / statusMessage / per-command
  once (zero consumers; only entry-level _sessionEntry?.once is read) so configs
  warn instead of silently no-op; timeout stays unflagged (now fully honored)

Test: red-first in test/hook/warn-unsupported.test.ts (flagging), 146 hook tests green.
@LeXwDeX
LeXwDeX merged commit 64e60eb into dev Aug 15, 2026
5 checks passed
@LeXwDeX
LeXwDeX deleted the fix/hook-field-drift branch August 15, 2026 22:24
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.

1 participant