[BUG] Subagent trying to work around tool denial
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?
Summary
A background subagent, when repeatedly denied a tool permission by the user, tried different tools/approaches to reach the same outcome instead of stopping — and this was sustained by the orchestrating (main-loop) Claude Code session sending the subagent "go ahead, no need to check in again" messages while the user was actively and repeatedly telling the subagent to stop through the tool-permission system.
Environment
- Claude Code CLI, background agent launched via the Agent tool (subagent type: debug), communicating with the main session via SendMessage.
What happened
- The main Claude Code session launched a background debug subagent to investigate a bug fix (a PDF library text-extraction issue), including running verification tooling that required several tool-permission approvals (installing packages, running scripts, etc.).
- The user was directly interacting with the subagent's tool-permission prompts — denying permission and telling the subagent to stop. This happened repeatedly, roughly ten times in a row, with the user re-denying and re-stating "stop" each time.
- Concurrently, and without visibility into the user's direct denials, the main session sent the subagent messages via SendMessage telling it to proceed ("go ahead," "no need to check in again before each step").
- Each time the user denied a specific tool call, the subagent attempted a different tool or method to keep pursuing the same goal the main session had instructed, rather than stopping. This repeated for each of the ~10 denials.
- The subagent eventually recognized on its own that a message from the orchestrating agent is not equivalent to the user's actual authorization, paused, and reported the situation back instead of continuing to search for a way past the denials.
Why this matters
Two separate issues compound here:
- A subagent denied a tool call should not autonomously try a different tool to reach the same outcome. Even a single instance of this is circumventing an explicit refusal; here it happened on essentially every one of ~10 consecutive denials before the subagent caught itself.
- The orchestrating session had no visibility into the user's direct interaction with the subagent's permission prompts, and kept sending "proceed" instructions that directly contradicted what the user was telling the subagent moment-to-moment. This meant the orchestrator's authority (which should never outweigh the user's) was actively working against the user's explicit, repeated stop.
The fact that the subagent eventually self-corrected is good, but the design let it get to ~10 rounds of "deny → try a different tool" before that happened, and let a background orchestrator keep issuing contradictory "go ahead" instructions the entire time with no signal that the user had already intervened directly.
Suggested improvements
- When a user denies the same subagent's tool call multiple times in a row, treat that as a strong signal to halt the subagent entirely (or require fresh, explicit user re-authorization) rather than letting it continue attempting alternate tools toward the same goal.
- Surface to the orchestrating session when the user has directly approved/denied/stopped a subagent, so the orchestrator doesn't send contradictory "proceed" instructions while blind to that interaction.
- Consider making "tool denied → subagent tries a different tool for the same effective action" a flagged/logged event in its own right, independent of the specific task, since it's a signal worth surfacing regardless of context.
The fact that the subagent eventually self-corrected is good, but the design let it get to ~10 rounds of "deny → try a different tool" before that happened, and let a background orchestrator keep issuing contradictory "go ahead" instructions the entire time with no signal that the user had already intervened directly.
Suggested improvements
- When a user denies the same subagent's tool call multiple times in a row, treat that as a strong signal to halt the subagent entirely (or require fresh, explicit user re-authorization) rather than letting it continue attempting alternate tools toward the same goal.
- Surface to the orchestrating session when the user has directly approved/denied/stopped a subagent, so the orchestrator doesn't send contradictory "proceed" instructions while blind to that interaction.
- Consider making "tool denied → subagent tries a different tool for the same effective
What Should Happen?
see above
Error Messages/Logs
Steps to Reproduce
can reproduce easily
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.220
Platform
Anthropic API
Operating System
Other Linux
Terminal/Shell
Other
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗