fix(hooks): emit allow with Claude updatedInput#3012
Open
eejd wants to merge 1 commit into
Open
Conversation
|
|
Contributor
|
Automatic message from CI checks : It seems like this branch is targeting the wrong branch, any contribution should target develop branch. See CONTRIBUTING.md for details. |
tapheret2
reviewed
Jul 16, 2026
tapheret2
left a comment
There was a problem hiding this comment.
Review: fix(hooks): emit allow with Claude updatedInput
Files: src/hooks/README.md, src/hooks/hook_cmd.rs
Size: +19 / -16
Notes
- Static pass on the patch: no obvious blockers from the diff alone.
Thanks @eejd — independent review on the patch.
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.
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.