[BUG] Subagent task output not size-capped, single session filled 569GB on disk
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?
A single Claude Code session consumed 569GB of disk space in /private/tmp/claude-501/<project>/<session-id>/tasks/ because subagent .output files are not size-capped. Three subagents each wrote ~190GB files (196GB, 187GB, 186GB) to disk in under 24 hours, nearly filling a 1TB SSD.
Root cause: subagents ran npm start on an Azure Functions project, which invokes func start. Without --worker-runtime specified, func prompts interactively: "Select a number for worker runtime: Choose option:". Subagents have no stdin/TTY, so func loops infinitely re-printing "Choose option:". The subagent output buffer has no size cap, so Claude Code wrote billions of repeated prompts to disk until the SSD was nearly full.
Impact: macOS reported 776GB as "System Data" in Storage settings. I had 2GB free when discovered. Content of output files confirmed to be the string "Choose option: " repeated until the file hit 210,664,984,575 bytes.
What Should Happen?
Subagent output should be capped at a reasonable size (e.g. 10-100MB). When the cap is hit, the subagent process should be terminated and reported as failed. Ideally, interactive-prompt detection would fail the subagent early when stdin is unavailable.
Error Messages/Logs
Subagent output files grow unbounded until disk is nearly full. No warning or cap is enforced.
Steps to Reproduce
- Have a project with an Azure Functions backend where package.json has "start": "func start" (no --worker-runtime flag)
- Open Claude Code in that project
- Ask Claude to run or test the backend such that it spawns Task subagents to execute npm start
- Subagents hang indefinitely on the interactive "Choose option:" prompt
- Observe /private/tmp/claude-501/<project>/<session>/tasks/*.output files grow without bound
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
v2.1.98
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗