[BUG] Task tool with subagent_type "Bash" auto-denies Bash commands when run_in_background: true
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 using the Task tool with subagent_type: "Bash" and run_in_background: true, all Bash commands are auto-denied without prompting the user. This is especially counterintuitive because the "Bash" agent type is described as a "Command execution specialist for running bash commands" — yet it cannot execute any bash commands when running in the background.
Actual Behavior
- All Bash commands are silently auto-denied
- The error message says "Permission to use Bash has been denied"
- No prompt is shown to the user
- The agent cannot accomplish anything and returns a failure message
Context
I was using 4 parallel background Bash agents to collect GitHub PR review comments via gh api. All 4 agents failed identically because they could not run any Bash commands.
// All 4 of these agents failed
Task({
subagent_type: "Bash",
run_in_background: true,
prompt: "Run this python script that calls gh api..."
})
Environment
- Claude Code Version: 2.1.39
- Platform: Linux (WSL2)
- OS: Linux 5.15.146.1-microsoft-standard-WSL2
Workaround
Related issue #18172 suggests using PreToolUse hooks to override the auto-deny behavior, but this should not be necessary for an agent type whose only purpose is running Bash commands.
Related Issues
- #18172 - Background agents cannot run Bash commands (closed, not planned)
- #18885 - Allow subagents to forward permission requests
- #27249 - Background agents in skill context can't execute Bash
What Should Happen?
Expected Behavior
A "Bash" agent type should be able to execute bash commands — that is its entire purpose. At minimum, one of the following should apply:
- Background Bash agents inherit the permissions already granted in the parent session
- Background Bash agents prompt the user for permission (forwarding the prompt to the foreground)
- The
subagent_type: "Bash"agent has implicit Bash tool permission, since that is its sole capability
Error Messages/Logs
Steps to Reproduce
Steps to Reproduce
- Call the
Tasktool with:
subagent_type: "Bash"run_in_background: true- A prompt that instructs the agent to run a bash command (e.g.,
gh api ...orpython3 ...)
- The agent attempts to use the
Bashtool - The command is auto-denied with:
"Permission to use Bash has been denied"
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.68
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
WSL (Windows Subsystem for Linux)
Additional Information
_No response_
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗