fix(hookify): load only event:all rules for unknown tools, not all rules#68672
Closed
AZERDSQ131 wants to merge 2 commits into
Closed
fix(hookify): load only event:all rules for unknown tools, not all rules#68672AZERDSQ131 wants to merge 2 commits into
AZERDSQ131 wants to merge 2 commits 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.
…oading all rules When tool_name was neither Bash nor Edit/Write/MultiEdit, the local variable `event` remained None. Passing event=None to load_rules() bypasses all filtering and returns every rule regardless of the event field, including bash- and file-specific rules that were never intended to run for tools like Read, Glob, or Task. Add an explicit else branch: event = 'all'. Only rules declared with event: all are now evaluated for unknown tools.
Author
|
Closing: absorbed by #68673 which is a superset covering the same hookify files |
This was referenced Jun 16, 2026
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/hooks/pretooluse.pyandposttooluse.py, whentool_nameis notBashorEdit/Write/MultiEdit, theeventvariable is never assigned and remainsNone:load_rules(event=None)skips all filtering and returns every enabled rule. This means rules declaredevent: bash(matching shell commands) orevent: file(matching file content) are evaluated againstRead,Glob,Taskand other tools — producing false positives or unexpected blocks.Fix
Add an explicit
elsebranch that setsevent = 'all'. Rules declaredevent: allare explicitly opt-in for all tools. Bash/file-specific rules are never reached for unknown tools.Fix applied identically in both
pretooluse.pyandposttooluse.py.🤖 Generated with Claude Code