Background task output file grows unbounded when process restarts in a loop

Resolved 💬 2 comments Opened Mar 12, 2026 by dilverse Closed Mar 12, 2026

Summary

When a background task (run_in_background: true) spawns a process that restarts repeatedly (e.g. crashes and re-spawns in a tight loop), the output file in /private/tmp/ grows without any size cap, and can fill the entire disk.

What happened

  1. Claude launched a process as a background Bash task.
  2. The process kept restarting in a tight loop.
  3. Each restart wrote a few lines of output to the task output file.
  4. This repeated hundreds of millions of times with no limit, consuming 1.7 TB and filling the disk.

Impact

  • Disk went from ~4% free to completely full with no warning.
  • macOS became unresponsive until the file was manually deleted.
  • No alert or error was surfaced to the user inside Claude Code.

Expected behavior

Background task output files should have a size cap, with either:

  • A hard truncation with a warning message, or
  • The background task being killed and an alert shown to the user when the limit is hit.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗