[BUG] CLI does not emit can_use_tool control_request when --permission-prompt-tool stdio
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When the CLI is run with --permission-prompt-tool stdio (e.g. by the Python Agent SDK when can_use_tool is set), it never sends control_request events with subtype can_use_tool before executing tools. Tool use succeeds (e.g. Write creates the file), but the parent process (SDK) never receives a permission request, so permission callbacks never run.
Observed Behavior: No permission request is emitted. The CLI runs the tool and continues; the SDK’s can_use_tool callback is never invoked.
Impact: Human-in-the-loop or other permission flows that rely on the control protocol cannot work when the SDK drives the CLI with permission_prompt_tool_name="stdio".
Environment: CLI 2.1.73 + 2.1.74 (Claude Code), Python SDK 0.1.48. Same behavior reported on other versions (see linked SDK issue).
Related: https://github.com/anthropics/claude-agent-sdk-python/issues/469 (tracking the symptom from the SDK side; the fix likely belongs in the CLI).
What Should Happen?
Before running a tool, the CLI sends a control_request with subtype can_use_tool over the control channel and waits for a control_response (allow/deny) from the parent.
Error Messages/Logs
Steps to Reproduce
- Use the Python SDK to run the Claude Code CLI (e.g.
run()or equivalent that spawns the CLI subprocess). - Set
permission_mode="default"and pass acan_use_toolcallback that logs or prints when invoked. - Send a prompt that causes the model to use a tool (e.g. “Create a file called test.txt with hello inside”).
- Expected: Callback runs before the tool executes. Actual: Callback never runs; the tool runs and the run completes without any callback invocation.
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.74
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
WSL (Windows Subsystem for Linux)
Additional Information
_No response_
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗