Desktop scheduled-tasks / local-agent-mode leak orphaned `claude` processes until app restart

Resolved 💬 2 comments Opened Jun 21, 2026 by imagiclondon Closed Jun 24, 2026

Environment

  • Surface: Claude desktop app (macOS) scheduled tasks + local agent mode (+ Cowork VM)
  • Claude Code runtime: 2.1.181
  • macOS: Tahoe 26.5.1 (Apple Silicon, 36 GB RAM)
  • ~25 enabled scheduled tasks (cron + one-time); several high-frequency (every 30 min / hourly); several use local agent mode and MCP servers

What's wrong

Over a single overnight period, scheduler / local-agent-mode sessions spawned claude (Claude Code) child processes that never exited. Dozens accumulated, each ~5-6% CPU continuously, several with 15 to 34 hours of accumulated CPU time. System load reached ~130; process count ~1,334 with ~12,700 threads. The Mac ran hot all night.

Quitting and reopening the Claude desktop app cleared every orphaned process and the machine cooled immediately. The processes were the Claude Code binary owned by the user (not malware).

Expected

Sessions spawned by the scheduler should terminate after the task completes or times out, and should not accumulate across firings.

Actual

Sessions appear to hang and remain resident, accumulating until the app is restarted.

Evidence

  • Activity Monitor pre-restart: 1,334 processes / 12,722 threads; dozens of claude processes at ~5-6% CPU; several with 15 to 34h CPU time.
  • Energy tab: Claude desktop app "12 hr Power" approx 3,106 (about 43x the next app); "Preventing Sleep: Yes".
  • After app restart: ~898 processes; remaining claude processes are healthy children of the freshly spawned orchestrator (near-zero CPU).
  • main.log: many [CCDScheduledTasks] Spawning new session for scheduled task ...; ~895 spawn events; 11,000+ timeout lines; ~900 error lines.
  • Power assertion (live): the app holds NoIdleSleepAssertion named "Electron" continuously while running, so the host never idle-sleeps; combined with non-terminating sessions, heat builds overnight.
  • Cowork VM logs: repeated [Keepalive] Already running / VM already connected / Installing SDK loops.

Steps to reproduce (likely)

  1. Configure many scheduled tasks, including high-frequency ones (every 30 min) that use local agent mode + MCP servers.
  2. Leave the desktop app running overnight.
  3. Observe accumulating claude processes and rising system load; confirm they clear on app restart.

Impact

Sustained high CPU and heat, fan noise, energy drain, and degraded performance until a manual app restart. The continuous no-idle-sleep assertion compounds it.

Questions

  • Should scheduler-spawned sessions self-terminate? Is there a known leak when sessions time out?
  • Can concurrent scheduled-task sessions be capped, and orphaned sessions auto-reaped?

View original on GitHub ↗

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