fix(hook): apply prompt-hook timeout, surface dropped HookCommand fields - #288
Merged
Conversation
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.
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.
修复 issue #286(HookCommand schema 接受但执行器静默丢弃的字段)。
Fix
promptHandler补Effect.timeout(entry.timeout ? entry.timeout*1000 : DEFAULT_TIMEOUT_MS)——头部文档承诺所有 hook 类型都支持 timeout,此前唯 prompt 型未执行;超时经Effect.exit捕获后降级为既有非阻塞 warn。detectUnsupportedFields追加allowedEnvVars/statusMessage/per-commandonce(全仓库零消费者;entry 级 once 才有效)——配置者得到 warn 而非静默 no-op。timeout不列入(已完整落地)。Evidence(/tdd)
test/hook/warn-unsupported.test.ts新增 flagging 用例(先 fail 后绿)bun test test/hook146 pass / 0 fail;typecheck 干净any、沿用既有 timeout 成语式、真实函数无 mock