[BUG] Background subagent tool calls silently denied — permission dialog never surfaced
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 Claude Code dispatches a background subagent (via the Agent tool with run_in_background: true), and that subagent attempts a tool call requiring user permission (e.g., writing a file outside the current working directory), the permission dialog is never surfaced to the user. The tool call is silently denied. The user is never informed that a permission was needed.
What Should Happen?
Either:
- The permission dialog should be queued and shown to the user when the main conversation is idle (or as an interruption)
- Or the background agent should be clearly notified that it was blocked by permissions, and the parent conversation should surface this to the user
Error Messages/Logs
No error is shown to the user. The background subagent reports back that it was unable to write files because "all file-writing tools (Edit, Write, and Bash with file redirection) are being denied by permissions." The exact internal rejection message seen by the subagent is unknown — it was never surfaced.
Steps to Reproduce
- Open Claude Code in
~/projects/frontend/(default permission mode) - Ask Claude to perform a task that involves modifying files in a sibling directory, e.g.:
> "Write a README for the shared utils in ~/projects/shared-lib/"
- Claude dispatches this as a background subagent (e.g., because it has other parallel work to do)
- The subagent reads files in
shared-lib/successfully, then attempts toWritea file there - Since
shared-lib/is outside the current working directory, the tool call requires user permission - Observe: No permission dialog appears in the terminal. The subagent silently fails and reports back that it could not write files due to permissions.
Note: The identical task succeeds when dispatched as a foreground subagent, because the permission dialog is shown inline in the terminal.
Claude Model
Opus
Is this a regression?
I don't know
Claude Code Version
2.1.85 (Claude Code)
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
VS Code integrated terminal
Additional Information
The core issue is that background subagents have no channel to surface permission prompts to the user. Reading files outside the working directory works fine, but write operations require explicit permission that can never be granted in background mode.
🤖 Generated with Claude Code
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗