[BUG] Plan mode exit → agent launch: denial of ExitPlanMode incorrectly cascades as denial of subsequent Task tool call
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?
CLI version: 2.1.59 (behavior not observed in 2.1.37)
Steps to reproduce:
- Enter plan mode (/plan or via EnterPlanMode)
- Claude calls ExitPlanMode to request approval
- User denies ExitPlanMode with feedback: "Good plan, but launch an agent to
handle this instead"
- Claude immediately calls the Task tool to launch a general-purpose agent
- User never sees a prompt to approve/deny the Task tool call
- Claude's context receives a "tool rejected" signal for the Task call — but the
agent appears to have launched and executed work anyway
What I observed:
- I saw a few approval prompts (for sketch edits and git operations) appearing to
come from an agent, with no preceding prompt asking me to approve launching an
agent at all
- After approving those, the agent continued running silently with no visible
progress — I could not distinguish "agent is working" from "agent is stuck"
- Claude reported the Task call as rejected and believed no work had been done
Root cause hypothesis:
When the user denies ExitPlanMode and includes text saying "launch an agent
instead," the CLI may be recycling/cascading that denial event to cover the next
tool call (the Task launch), skipping the approval prompt entirely. This creates
two problems:
- The agent launches without explicit user approval of the Task tool call
- Claude's context receives a rejection signal even though the agent is actually
running, causing Claude to incorrectly believe nothing happened
Expected behavior:
- Denial of ExitPlanMode should only apply to ExitPlanMode
- The subsequent Task tool call should surface its own fresh approval prompt
- If the agent is running, Claude's context should not receive a rejection signal
for that call
Additional UX issue (separate but related):
Once a background agent is approved and running, there is no real-time visibility
into its progress in 2.1.59. The UI shows only a spinner with no indication of
which files are being edited or which tool calls are being made. This makes it
impossible to distinguish an active agent from a stalled one.
What Should Happen?
It should be clear when Claude is proposing to launch an agent or not, especially when it is presenting a numbered prompt. If a numbered prompt is rejected with a message, that message should be evaluated and a new prompt or discussion initiated to clarify the user's intended behavior. Sub-agents should not be launched without their work being visible to the main agent and the user.
Error Messages/Logs
Steps to Reproduce
- Enter plan mode (/plan or via EnterPlanMode)
- Claude calls ExitPlanMode to request approval
- User denies ExitPlanMode with feedback: "Good plan, but launch an agent to
handle this instead"
- Claude immediately calls the Task tool to launch a general-purpose agent
- User never sees a prompt to approve/deny the Task tool call
- Claude's context receives a "tool rejected" signal for the Task call — but the
agent appears to have launched and executed work anyway
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.59
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗