Repository navigation
fix(mod): only take ExitPlanMode PermissionRequest events (#2159) - #2160
Merged
Merged
Conversation
The mod's classic.PermissionRequest hook was registered with no matcher, so
under a guard plugin seated above (cc-plugin-sec-default on Team/Enterprise
accounts) Claude Code printed "its classic.PermissionRequest hook was skipped"
at the first permission prompt of any tool. Register it with the matcher
{ tool_name: 'ExitPlanMode' }; the plan approval path is unchanged (#2043's
approval record answers a skip there).
Tests: the registration's matcher (bun), and in the engine harness the
approved ExitPlanMode prompt answered by the mod with updatedInput.plan and
setMode while another tool's prompt goes past it; also updates a stale
harness assertion for the Inbox's search action.
1 task
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.
Part of #2159 (part 2 only).
What changed
The mod's
classic.PermissionRequesthook (apps/hook/hooks/mod/register.ts) was registered with no matcher, so the engine selected it for every tool's permission prompt and returnednext(e)for everything but ExitPlanMode. Under a guard plugin seated above the mod (cc-plugin-sec-defaulton Team/Enterprise accounts), that made Claude Code printplannotator: its classic.PermissionRequest hook was skipped…at the first permission prompt of any tool in every session.It is now registered with the engine's own matcher,
on('classic.PermissionRequest', { tool_name: PLAN_TOOL }, …)(the sameon(event, matcher, hook)formcommand.runalready uses;tool_nameis a field of the PermissionRequest input in the engine's types). The engine no longer selects the hook for other tools. During a plan approval the guard can still skip it, and #2043's approval record answers that in the classic command hook, as before. ExitPlanMode behaviour is unchanged (allow withupdatedInput.planandsetMode).claude plugin validate apps/hookpasses and listsclassic.PermissionRequest{tool_name=?}.Tests
apps/hook/hooks/mod/register.test.ts: the hook is registered once, with matcher{ tool_name: 'ExitPlanMode' }; no wildcard orclassic.*registration.scripts/test-claude-code-mod.sh,apps/hook/tests/register.test.ts): the approved ExitPlanMode's permission prompt is answered by the mod (allow,updatedInput.plan,setMode) and the hooks beneath never run; a Bash permission prompt goes past the mod to the hooks beneath unchanged. Also fixes a stale harness assertion (the bundled Inbox tool list now hassearch). Harness: 38 pass, 0 fail (Claude Code 2.1.310).bun test apps/hook/hooks/mod/190 pass;bun run typecheckclean.Not in this PR
Part 1 of the issue (the
prompt.contextskip notice for the Inbox reminder, e.g. moving it to a SessionStart command hook) is a design decision left for the owner.