fix(hookify): PostToolUse hooks cannot return permissionDecision: deny#68671
Closed
AZERDSQ131 wants to merge 1 commit into
Closed
fix(hookify): PostToolUse hooks cannot return permissionDecision: deny#68671AZERDSQ131 wants to merge 1 commit into
AZERDSQ131 wants to merge 1 commit into
Conversation
…olUse block logic A blocking rule in rule_engine.py returned permissionDecision:"deny" for both PreToolUse and PostToolUse events. PostToolUse fires after the tool has already executed; sending permissionDecision:"deny" has no effect and produces undefined behaviour in the Claude Code hook protocol. PreToolUse now returns the deny decision as before. PostToolUse and all other non-Stop events fall through to the plain systemMessage path, which is the only valid output format for post-execution hooks.
Author
|
Closing: absorbed by #68673 which is a superset covering the same hookify files |
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.
Problem
In
plugins/hookify/core/rule_engine.py, theevaluate_rulesfunction returnedpermissionDecision: "deny"for bothPreToolUseandPostToolUsehook events:PostToolUsefires after the tool has already executed. The Claude Code hook protocol explicitly states thatpermissionDecisionis only meaningful forPreToolUse. Sending it forPostToolUseproduces undefined behaviour (the field is silently ignored or causes a protocol error depending on the runtime version).Fix
Split the two cases:
PreToolUse→ returnspermissionDecision: "deny"as before (correct)PostToolUseand all other non-Stop events → returns onlysystemMessage(the only valid output for post-execution hooks)Testing
Covered by reading the hook protocol spec and tracing
evaluate_rulescall sites inpretooluse.pyandposttooluse.py.🤖 Generated with Claude Code