Task tool subagents inconsistently fail to write files when run in parallel
Description
When spawning multiple subagents in parallel via the Task tool, some agents successfully write files while others (spawned simultaneously) fail to persist file writes. The failing agents show <write_file> tags in their output, but files are not created on disk.
Environment
- Claude Code: VSCode Extension
- OS: Windows 11
- Model: claude-opus-4-5-20251101
Configuration
All agents have identical tool permissions in their frontmatter:
tools: ["Read", "Write", "Edit", "Grep", "Glob", "Bash"]
Global settings.json:
{
"permissions": {
"dangerouslySkipPermissions": true
}
}
Project settings.json also has:
{
"permissions": {
"dangerouslySkipPermissions": true
}
}
Steps to Reproduce
- Create two subagents with identical tool configurations (e.g.,
backend-developerandfrontend-developer) - Spawn both in parallel using Task tool:
Task(subagent_type: "backend-developer", prompt: "...", run_in_background: true)
Task(subagent_type: "frontend-developer", prompt: "...", run_in_background: true)
- Wait for both to complete
Expected Behavior
Both agents should be able to write files using their configured Write/Edit tools.
Actual Behavior
- Backend agent: Successfully created files (
scoring_engine.py,bulk_data_fetcher.py, etc.) - Frontend agent: Shows
<write_file>tags in output but files are NOT created on disk
When I later spawned a test-writing agent, it also failed to write - output showed tool usage but no files persisted. I had to implement the changes myself in the main chat.
Verification
- Confirmed both agents have
tools: ["Read", "Write", "Edit", "Grep", "Glob", "Bash"] - Confirmed
dangerouslySkipPermissions: truein both global and project settings - Verified with
dircommand that files don't exist after agent "completes" - This is NOT a resumed session - single continuous session
Impact
This causes ~2x token usage because:
- Agent reads files and "writes" (but doesn't persist)
- Main chat must re-read same files and implement manually
Additional Context
This occurred in a single continuous session (not resumed). The agents were spawned at the exact same time in parallel, ruling out session-length degradation as a cause.
🤖 Generated with Claude Code
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗