Repository navigation
Claude Code mod: hook tool.run by name; the mod needs Claude Code 2.1.326+ - #4222
Merged
Merged
Conversation
From Claude Code 2.1.329 the engine no longer raises tool.run for a hook registered as tool.*; it still raises tool.call and tool.check there. Behind the guard's early-run rule (Team/Enterprise logins) the mod passes a held plannotator tool call or taken-over Bash command on at tool.call and opens it at tool.run, so every such open fell through to "no hook answered this call" (#3915). The run hook is now registered as tool.run, inside a try: an engine before 2.1.326 refuses the name, and there no call is ever passed on to tool.run. The tool.* glob is gone, and with it the mod's place in every tool.* chain (the "its tool.describe hook was skipped" line behind the guard). The bun test raises tool.run only to a hook registered by that name, and loads the module through an on() that refuses the name. The engine harness stand-in guard hooks tool.call and tool.run by name, and CI's harness matrix adds 2.1.330.
An engine before 2.1.326 refuses to load a module whose source names
tool.run, so the literal on('tool.run') in register.ts took every
Plannotator feature away there. run.ts holds only that hook and calls
the one register.ts hands over (setRunHook); an older engine refuses
run.ts alone and keeps register.ts. No tool.* glob remains, so one hook
hears tool.run on every engine.
Not the final change. One hooks module again (run.ts removed: 2.1.287 refuses a plugin with two modules). The run hook stands on the patterns the engine's grammar allows that could select tool.run without naming it, first outermost: `*`, `!engine.create`, `tool.*`, each matched on RUN_MATCHER. The first registration to hear a call owns it (keyed by tool_use_id); later ones pass it on, so an engine where several hear it opens the call once. Each hearing is recorded (early-run.ts runHeard) and written to the mod's debug log when it is on. The engine harness gets one probe per pattern (a Bash command the mod passes on) that prints what heard tool.run and asserts its pattern did. The Claude Code mod guide is now stale.
…rce check requires
…iment
From Claude Code 2.1.329 no glob hears tool.run, so the run hook is
registered as on('tool.run', RUN_MATCHER, <function literal>), the one hook
on that event. Claude Code before 2.1.326 refuses the module for it, so the
mod now needs 2.1.326 or later (#3915). The bun tests hold the registration
to one hook with a literal name in the source.
On 2.1.287 and 2.1.325 the script now expects the hooks module refused for naming tool.run: every test must fail with that refusal and none pass. On 2.1.327 and 2.1.330 a second stand-in guard, refusing every launch while the tool's call is held, checks annotate, review and last opened at tool.run.
backnotprop
marked this pull request as ready for review
November 29, 2026 21:43
This was referenced Nov 30, 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.
Fixes #3915.
The bug
From Claude Code 2.1.329, on logins where Claude Code's own guard holds tool calls first (Team and Enterprise), the
tool.runevent reaches only a hook registered under that exact name. The mod registeredtool.*, so it never heard the event: theplannotatortool'sannotate,reviewandlastanswered "registered the tool plannotator but no hook answered this call", and aplannotator annotate|review|lastrun through Bash fell back to the blocking CLI.The fix
The mod registers one hook on
tool.runby name. The earliertool.*hook served that event and nothing else, so it is removed.The mod now needs Claude Code 2.1.326 or later
Claude Code before 2.1.326 has no
tool.runevent and refuses a hooks module that names it. We found no way for one module to serve both ranges, so on Claude Code 2.1.287 to 2.1.325 the mod no longer loads: noplannotatortool, noplannotator_inboxtool, no Inbox reply wake. The/plannotator-*skills (installed outside the plugin) and the CLI are unaffected. The plugin's classic plan-review hook is expected to keep running there, but no test covers that.Every place that states the mod's minimum version now says 2.1.326 (README, docs site, the Inbox's setup hint,
plannotator inbox --help).Tests
tool.*put back).annotate,reviewandlasteach open once attool.run. On 2.1.287 and 2.1.325 the job checks that the run fails with the module's"tool.run" is not an eventrefusal and that no module is refused for another reason.Not proven