You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(hooks): emit allow with Claude updatedInput - #3012
update the Claude native hook response so every updatedInput payload includes permissionDecision: "allow"
add a regression test for the emitted JSON shape
update the hook permission-model docs to reflect the current Claude hook validator contract
Why
Current Claude hook validation rejects PreToolUse responses that return updatedInput without an explicit allow decision:
PreToolUse hook returned updatedInput without permissionDecision:allow
RTK's Claude hook previously omitted permissionDecision for default/ask rewrites. That makes the rewrite payload invalid even though the rewritten command itself is fine.
This change keeps deny/defer passthrough behavior unchanged, but when RTK does return a rewritten updatedInput, it emits:
This PR branch was created from upstream/master and contains only one commit. Diff is limited to:
src/hooks/hook_cmd.rs
src/hooks/README.md
Testing
On the fork branch that originally carried this change:
/opt/local/bin/cargo test hooks::hook_cmd
passed: 77 hook tests.
On a clean branch based directly on upstream/master, the same test command currently fails before running tests due to pre-existing upstream dead-code warnings unrelated to this PR:
error: constant `FILTERS_TOML` is never used
error: associated function `load` is never used
I also verified the runtime payload shape locally with:
printf'%s\n''{"tool_name":"Bash","tool_input":{"command":"git status","description":"Check repo status"}}'| rtk hook claude
and confirmed the response includes permissionDecision: "allow" next to updatedInput.
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You have signed the CLA already but the status is still pending? Let us recheck it.
Thank you for working on this. Closing as no longer applicable: the situation this change describes does not hold anymore, so the hook no longer needs to emit an explicit allow with every updatedInput. If you still see that validator error on a recent build, please comment with the Claude Code version and this can be reopened.
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
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.
Summary
updatedInputpayload includespermissionDecision: "allow"Why
Current Claude hook validation rejects
PreToolUseresponses that returnupdatedInputwithout an explicit allow decision:RTK's Claude hook previously omitted
permissionDecisionfor default/ask rewrites. That makes the rewrite payload invalid even though the rewritten command itself is fine.This change keeps deny/defer passthrough behavior unchanged, but when RTK does return a rewritten
updatedInput, it emits:{ "hookSpecificOutput": { "hookEventName": "PreToolUse", "permissionDecision": "allow", "permissionDecisionReason": "RTK auto-rewrite", "updatedInput": { "command": "rtk git status" } } }Scope
This PR branch was created from
upstream/masterand contains only one commit. Diff is limited to:src/hooks/hook_cmd.rssrc/hooks/README.mdTesting
On the fork branch that originally carried this change:
/opt/local/bin/cargo test hooks::hook_cmdpassed: 77 hook tests.
On a clean branch based directly on
upstream/master, the same test command currently fails before running tests due to pre-existing upstream dead-code warnings unrelated to this PR:I also verified the runtime payload shape locally with:
and confirmed the response includes
permissionDecision: "allow"next toupdatedInput.