Background Bash command reading other agents' output files can cause runaway disk usage (1.2TB)
Resolved 💬 5 comments Opened Mar 9, 2026 by magnetarai-founder Closed Apr 27, 2026
Bug Report
Summary
A background Bash command that reads from other background agents' .output files can cause runaway disk usage. In my case, it grew to 1.2TB before I manually killed it and deleted the file.
Reproduction Steps
- Launch multiple background agents (e.g., 6+ Agent tool invocations with
run_in_background: true) - While those agents are running, launch a background Bash command that reads their output files:
``bash``
# This was the actual command that caused the issue
for f in /private/tmp/claude-501/.../tasks/*.output; do
echo "=== $(basename $f) ==="
tail -3 "$f" 2>/dev/null || echo "(empty)"
done
- The background Bash command's own output file grows unboundedly as it captures the streaming JSONL from the still-running agents.
Expected Behavior
- Background command output files should have a size cap or circuit breaker
- Or:
tailon actively-growing files should not stream indefinitely into the output capture
Actual Behavior
- The output file at
/private/tmp/claude-501/.../tasks/<id>.outputgrew to 1.2TB - No automatic size limit or warning was applied
- Had to manually discover and delete the file
Environment
- Claude Code v2.1.71
- macOS Darwin 25.3.0
- Model: claude-opus-4-6
Suggested Mitigations
- Output file size cap: Kill background commands if their output file exceeds a threshold (e.g., 100MB)
- Warning on large output: Surface a warning when a background task's output exceeds a reasonable size
- Prevent self-referential reads: Detect when a background command is reading from the same
/tmp/claude-*/tasks/directory where other tasks are writing
🤖 Generated with Claude Code
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗