fix: restore plan content in ExitPlanMode tool call#451
Merged
benbrandt merged 2 commits intoagentclientprotocol:mainfrom Mar 24, 2026
Merged
fix: restore plan content in ExitPlanMode tool call#451benbrandt merged 2 commits intoagentclientprotocol:mainfrom
benbrandt merged 2 commits intoagentclientprotocol:mainfrom
Conversation
The plan text was accidentally dropped from the ExitPlanMode content array during the switch to built-in Claude Code tools (agentclientprotocol#316). This meant ACP clients could not display the plan when asking the user for approval — they only saw the title "Ready to code?" with no plan body. Restore the original `input.plan` → content mapping so the plan markdown is included in the tool_call and request_permission events. Fixes agentclientprotocol#450
josevalim
approved these changes
Mar 24, 2026
SteffenDE
approved these changes
Mar 24, 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.
Summary
The plan text was accidentally dropped from the
ExitPlanModecontent array during the switch to built-in Claude Code tools (#316, commitbe618f5). This meant ACP clients could not display the plan when asking the user for approval — they only saw the title "Ready to code?" with no plan body.We noticed this in the Fabriqa app where our plan approval UI was rendering an empty card.
What changed
Restored the original
input.plan→contentmapping intoolInfoFromToolUse()so the plan markdown is included in thetool_callandrequest_permissionevents.Before (broken):
After (fixed):
Where does
input.plancome from?The Claude Agent SDK passes tool inputs to the
canUseToolcallback asRecord<string, unknown>(seeOptions.canUseToolin@anthropic-ai/claude-agent-sdk/sdk.d.ts). When Claude callsExitPlanMode, the model includes the plan text in the input.The formal
ExitPlanModeInputtype (in@anthropic-ai/claude-agent-sdk/sdk-tools.d.ts) only declaresallowedPrompts, but it has a[k: string]: unknownindex signature that allows additional properties. The model consistently sendsplan(string) andplanFilePath(string). SDK v0.2.76 explicitly addedplanFilePathto the tool input for hooks and SDK consumers, confirming these fields are intentional.The original implementation (commit
0289dd9, "Support plan mode and all other permission modes" #40) relied oninput.planand worked correctly until the refactor in #316 dropped it.SDK history confirms
input.planis reliableThe Claude Agent SDK itself had a regression where
ExitPlanModeinput was empty (anthropics/claude-code#12288):input.planpopulatedinput: {}emptyinput.planrestoredplanFilePathThe SDK team treated the empty input as a critical bug and fixed it promptly. The current SDK (0.2.76) reliably sends
input.plan, so this adapter fix is safe to depend on.Test plan
input.planis providedinput.planis not providedFixes #450