fix(hooks): send hook_event_name so Claude Code hooks can tell events apart - #3482
Open
nosey-dewdrop wants to merge 1 commit into
Open
Conversation
… apart The payload already emits tool_input as an object for Claude Code compatibility, but it names the event 'event' while Claude Code names it 'hook_event_name'. A Claude Code hook is a single command wired to every event and branches on that key, so under Crush it falls through to its default branch and does nothing. Nothing errors and nothing is logged. Reproduced with a third-party Claude Code PreToolUse guard: fed today's payload for 'git push --force origin main' it records no events at all; with hook_event_name present the same guard, same command, same repo emits CHECK_FAIL and STOP. The existing 'event' key is unchanged, so hooks written for Crush keep working.
Contributor
|
All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the Contributor License Agreement (CLA) and hereby sign the CLA. |
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.
What
BuildPayloadnames the eventevent. Claude Code names the same fieldhook_event_name. A Claude Code hook is a single command wired to every event and branches on that key, so under Crush it falls through to its default branch and does nothing. Nothing errors and nothing is logged.The payload already emits
tool_inputas an object for Claude Code compatibility, andparseStdoutalready understandshookSpecificOutput, and the runner already honours exit code 2. The greeting is the one part of the contract that is still Crush-only.Reproduction
A third-party Claude Code
PreToolUseguard, same repo, same command (git push --force origin main), fed the payload Crush sends today:Same guard, same command, with
hook_event_namepresent:Change
The event name is emitted under both keys.
eventis untouched, so hooks written for Crush are unaffected.Verification
go test ./internal/hooks/...passes; the new test fails without the change (expected: "PreToolUse", actual: <nil>)gofmt -l internal/hooks/cleango vet ./internal/hooks/...cleanAI disclosure
Written with AI assistance. I understand the change, can debug it independently, and can discuss it without AI help.