fix: restore automatic plan approval on Claude Code 2.1.199+#235
Draft
blimmer wants to merge 2 commits into
Draft
fix: restore automatic plan approval on Claude Code 2.1.199+#235blimmer wants to merge 2 commits into
blimmer wants to merge 2 commits into
Conversation
…plan approval Claude Code 2.1.199 added a guard that silently discards an ExitPlanMode allow decision unless it carries updatedInput, so approving a plan in the browser left the session blocked on the terminal's own approval prompt. Echo the hook event's tool_input back verbatim in the allow envelope, and parse tool_input as a loose object so fields like planFilePath survive the round-trip. Verified against Claude Code 2.1.198 (no behavior change) and 2.1.201 (approval works again). Upstream: anthropics/claude-code#74256
a1e6fea to
c5c93c4
Compare
Valid hook events now come from a fishery factory (matching the existing codexStopHookPayload one) instead of seven hand-rolled literals. Malformed payload tests keep inline literals since they intentionally violate the type.
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.
Summary
Claude Code 2.1.199 added a guard that silently drops a PermissionRequest hook's
allowfor ExitPlanMode unless the decision includesupdatedInput, so approving a plan in the browser left the terminal stuck on Claude Code's own approval prompt. The approve envelope now echoes the event'stool_inputback verbatim asupdatedInput, and the hook schema parsestool_inputloosely so fields we don't model (likeplanFilePath) survive the round trip. I verified both sides against the real TUIs: approve works again on 2.1.201, and 2.1.198 behaves the same as before, so this ships without a version gate. Closes #234; the upstream report is anthropics/claude-code#74256.Review focus
We now rely on undocumented behavior (the guard keys on whether
updatedInputis present) and we echo back fields we never validate. The loose parse is deliberate: the SDK's ownExitPlanModeInputtype is an open object ([k: string]: unknown), and a closed schema would strip whatever field Claude Code adds next, which is exactly the class of breakage this PR fixes. Still, consider whether echoing unvalidated fields could bite us if Claude Code ever puts something large or sensitive in that object.Commits
c5c93c4— fix: echo tool_input as updatedInput so Claude Code >=2.1.199 honors plan approval1953246— test: add a claudeHookPayload factory for Claude hook tests