{"version":"2.1.326","anchor":"hook-matchers-gain-whenunanswered-for-pretooluse-sdk-host-h","canonical_anchor":"hook-matchers-gain-whenunanswered-for-pretooluse-sdk-host-h","heading":"PreToolUse hook matchers gain a whenUnanswered setting for SDK hosts","tier":"use","area":"Agents","scope":"individual","heads_up":false,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.326\/e\/hook-matchers-gain-whenunanswered-for-pretooluse-sdk-host-h","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.326","markdown":"### PreToolUse hook matchers gain a whenUnanswered setting for SDK hosts\n\nSDK hosts can set whenUnanswered on a PreToolUse hook matcher to control what happens to a tool call nobody answers\n\n**Unclear.** What each of the four fields makes Claude Code do is not clear.\n\n**What**\n\nA hook is code that runs at a set moment. A `PreToolUse` hook runs before Claude uses a tool, which is an action such as editing a file or running a command, and it can block that action. A program that embeds Claude Code through the SDK (a software kit for building on Claude Code) can register these hooks with a matcher, the rule that decides which tool calls the hook handles. That matcher can now carry a `whenUnanswered` setting, defined by `SDKHookCallbackMatcher`. Before this release, a matcher's `whenUnanswered` was ignored.\n\n- `whenUnanswered` takes `afterSeconds`, `within`, `readsAlsoWithin` and `noWritesWithin`.\n\n- Invalid values are ignored, and the tool call is then refused when the hook's time limit runs out.\n\n- The setting only applies when `onFailure` is not `\"continue\"` and the process owns Claude Code's standard input, the channel it reads typed input from.\n\nIn the same change, the records Claude Code keeps about agents gained the fields `takesNoHooks`, `inWorkflowRun`, `requireCanUseTool` and `runLimits`.\n\n**Why**\n\nThis changes how a tool call is settled when the host's permission hook never replies. Developers building on the SDK can now choose how long to wait and under what conditions. A badly formed setting does not fail open: the call is refused at the hook's time limit.\n\n- Area: Agents\n- Names: `whenUnanswered`, `PreToolUse`\n- Tier: Use it now\n- Useful: 5\/5\n- Signal: 4\/5\n- Scope: individual\n- Heads-up: no"}