Skip to content

fix(crush): skip crush.hooks override keys that name no Crush event - #3909

Merged
dyoshikawa merged 3 commits into
mainfrom
resolve-issue-3672-crush-unknown-hook-keys
Nov 20, 2026
Merged

dyoshikawa merged 3 commits into
mainfrom
resolve-issue-3672-crush-unknown-hook-keys

Conversation

@dyoshikawa

Copy link
Copy Markdown
Owner

Closes #3672

Summary

This is the last open item on #3672. Earlier work already landed the hook event mapping (#3708), dropping matchers on non-tool events, and the permissions command lists (#3818).

Crush validates the hooks block when it loads the config. If a key names an unknown event, it refuses to load the whole config with hook <key>: unknown event (see internal/config/[email protected]). The event list is unchanged in the latest stable release, v0.102.0. Until now, a crush.hooks override key that was neither a canonical event nor a Crush event was written verbatim. One example is the Claude Code spelling Stop, where Crush's event is TurnEnd. The generated crush.json then broke Crush.

  • canonicalToCrushHooks now checks an override key that resolves to no canonical event against all 13 Crush events, compared case-insensitively and ignoring underscores, the way Crush folds them. If it names no Crush event, it is skipped with a warning.
  • PermissionResult (and spellings like permission_result) is a real Crush event without a canonical counterpart, so it is still written verbatim and still round-trips.
  • Updated the Crush hooks note in docs/reference/file-formats.md and regenerated src/generated/docs-content.ts.

Tests

  • New unit test in src/features/hooks/crush-hooks.test.ts: an override Stop is skipped with one warning, while permission_result and the shared stop → TurnEnd are still emitted.
  • pnpm run check and pnpm run cicheck:content pass. In the full pnpm test, only the two load-sensitive budget tests (src/utils/glob.test.ts, src/features/permissions/shell-command-categories.test.ts) timed out at load average ~37. Both pass when run on their own.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4

dyoshikawa and others added 3 commits November 20, 2026 08:50
Crush refuses to load the whole config when a hooks key names an unknown
event ("hook <key>: unknown event"). An override key that is neither a
canonical event nor one of Crush's 13 events (for example the Claude Code
spelling `Stop`) was written verbatim and broke the config. Such keys are
now skipped with a warning; `PermissionResult` and other real Crush events
still round-trip verbatim.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4
…ush-unknown-hook-keys

# Conflicts:
#	src/generated/docs-content.ts
@dyoshikawa
dyoshikawa merged commit a9de319 into main Nov 20, 2026
10 checks passed
@dyoshikawa
dyoshikawa deleted the resolve-issue-3672-crush-unknown-hook-keys branch November 20, 2026 00:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Follow up Crush upstream updates: 12 new hook events and stricter hook validation on main (nightly)

1 participant