[BUG] Background bash command output has no size limit — can fill 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?
When using the Bash tool with run_in_background: true, output is captured to a file under /private/tmp/claude-*/tasks/<id>.output. This file has no size limit, so a single runaway command can fill the
entire disk.
A background bash command (tail following a symlink to an active agent's JSONL output) created a 297 GB output file.
What Should Happen?
Background command output files should have a reasonable size cap (e.g. 100 MB), after which output is truncated or the command is killed.
Error Messages/Logs
Steps to Reproduce
- Launch 3 background agents with run_in_background: true
- Before they complete, run a background bash command that reads their output files:
for f in /private/tmp/claude-/tasks/.output; do
tail -5 "$f"
done
- The .output files are symlinks to agent JSONL files that are actively being written to
- The bash command's own output capture file (bspzktftx.output) grows unboundedly as tail follows the symlinks
- Result: a single 297 GB file in /private/tmp/claude-*/tasks/
The core issue is that tail on a symlink to a growing file produces continuous output, and there's no size cap on the background command's output capture. But even without the symlink detail, any background
bash command that produces large output would hit the same problem.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.76 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
IntelliJ IDEA terminal
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗