fix(hook): echo tool_input as updatedInput so plan approval survives Claude Code 2.1.199+#1008
Open
flex-yj-kim wants to merge 1 commit into
Conversation
…Claude Code 2.1.199+ Since Claude Code 2.1.199, a PermissionRequest "allow" decision for ExitPlanMode is silently discarded unless it echoes updatedInput, because ExitPlanMode requires user interaction and is not an MCP tool. The CLI then falls back to its built-in approval dialog, so clicking Approve in the Plannotator UI never returned control to the agent session (deny was unaffected). This matches the reported behavior on 2.1.199 through 2.1.202. Echo the original tool_input (in scope as event.tool_input) as updatedInput in the Claude Code allow decision. Backward compatible: older Claude Code versions treat the echoed input as unchanged (verified no-op on 2.1.198). Fixes backnotprop#995
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.
Problem
Since Claude Code 2.1.199, clicking Approve in the plan review UI no longer returns control to the CLI — the page closes but the built-in plan-approval dialog reappears in the terminal. Deny is unaffected. Reproduced on 2.1.199–2.1.202.
Cause
2.1.199 added a guard that discards a
PermissionRequestallowforExitPlanModewhenupdatedInputis absent (ExitPlanMode requires user interaction and isn't an MCP tool). The hook emitted a bareallow, so it was dropped — along withupdatedPermissions. The deny path skips this guard, matching the symptom.Fix
Echo the original
tool_input(in scope asevent.tool_input) back asdecision.updatedInput. Backward compatible — a verified no-op on 2.1.198, so safe to ship unconditionally.Verification
Built the hook binary with this change, ran it against a mock
ExitPlanModeevent, and drove/api/approve; the decision now carriesupdatedInputplusupdatedPermissions. Independently confirmed on 2.1.201 in #995 and anthropics/claude-code#74256.Fixes #995