fix(hooks): register ToolFailureTracker + ISASync (shipped but never wired)#1398
Open
krikauskis wants to merge 1 commit into
Open
Conversation
…wired) Both hooks ship in v5.0.0 but settings.json registers neither on any event: - ToolFailureTracker.hook.ts declares TRIGGER: PostToolUseFailure and is documented under a 'PostToolUseFailure Hooks' section in hooks/README.md, but no PostToolUseFailure event exists in settings.json. - ISASync.hook.ts is the documented sole writer of session.phase/phaseHistory into work.json and is documented as a PostToolUse hook, but is never wired. Adds a PostToolUseFailure block registering ToolFailureTracker on the event its own header documents, and an async self-filtering PostToolUse entry for ISASync. No hook-body change.
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
Registers two hooks that ship in the release but are never wired in
settings.json:hooks/ToolFailureTracker.hook.tson a newPostToolUseFailureevent.hooks/ISASync.hook.tsas an async, self-filteringPostToolUseentry.Why
Both hooks ship in v5.0.0, both declare their own trigger in their headers, and
hooks/README.mddocuments both as wired — butsettings.jsonregisters neither,so neither hook ever fires. This is a documentation-vs-config drift.
ToolFailureTracker (
grep -c ToolFailureTracker settings.json→0): the hookdeclares
TRIGGER: PostToolUseFailureandhooks/README.mddocuments it under a"PostToolUseFailure Hooks" section, but no
PostToolUseFailureevent exists insettings.json. The observability hook meant to populateMEMORY/OBSERVABILITY/tool-failures.jsonlnever runs, so Pulse failure metrics aresilently empty for every user. (If a config instead wires this hook matcher-less
under
PostToolUse, it fires on success too and logs a falsetool_failureafterevery call — registering it on the correct event fixes that failure mode as well.)
ISASync (
grep -c ISASync settings.json→0):ISASyncis the documented solewriter of
session.phase/phaseHistoryintowork.json(seehooks/lib/isa-utils.tsand the hook header), and
hooks/README.mddocuments it as a PostToolUse hook — but itis never wired. Result: no ISA → work.json sync ever fires, so the Pulse Algorithm phase
view (
/api/algorithm) and the Agents pane are empty for every Algorithm run on astock install. The hook self-filters on
MEMORY/WORK/**/ISA.md, so it is inert for allother writes.
Change
Two additions to
settings.jsonhooks, matching each hook's documented contract:PostToolUseFailureblock registeringToolFailureTracker(async).PostToolUseentry forISASync(self-filtering; mirrors howToolActivityTrackeris already registered).No hook-body change.
Testing
grep -c ToolFailureTracker settings.json→ 0;grep -c ISASync settings.json→ 0; noPostToolUseFailurekey.MEMORY/OBSERVABILITY/tool-failures.jsonl(successful calls append nothing); an Algorithm task that writesMEMORY/WORK/<slug>/ISA.mdsyncs phase towork.jsonso/api/algorithmreturns the live phase and the Agents pane populates.Note for maintainers
The
PostToolUseFailureregistration assumes the Claude Code harness in your targetversion emits a
PostToolUseFailurehook event (the project documents it as one, and thehook's own header declares it). If the harness has renamed/removed it, the alternative is
to keep
ToolFailureTrackeronPostToolUseand have it self-filter on a populatedfailure field.
PostToolUse(for ISASync) is unambiguously supported — five entries inthe same file already use it.