[BUG] Workflow subagents balloon to ~2GB each and aren't cleaned up — regression 2.1.156 (OK) → 2.1.160

Open 💬 2 comments Opened Jun 2, 2026 by Colinchen-333

Summary

When using the Workflow / multi-agent (subagent) feature, the background spawns multiple claude subagent processes that each grow to ~2 GB RSS on average and are not cleaned up after the workflow completes, quickly exhausting system memory.

Clean version bisect

  • 2.1.156 — OK: workflows / parallel subagents behave normally. No memory blowup; subagent processes are modest and get cleaned up.
  • 2.1.160 — broken: running a workflow spawns multiple claude 2.1.160 subagent processes, each averaging ~2 GB RSS, and they pile up / are not cleaned up → memory exhausted.
  • 2.1.158 (also in this window) was not separately tested.

➡️ Regression introduced in (2.1.156, 2.1.160]. Downgrading to 2.1.156 fully resolves it.

Steps to reproduce

  1. Run a Workflow / spawn several parallel subagents.
  2. Watch the process list — multiple claude (2.1.160) subagent processes appear, each ~2 GB RSS.
  3. They persist / accumulate rather than terminating after the work completes → RAM blows up.

Expected

Subagent processes use modest memory and are terminated/cleaned up once the workflow finishes (the 2.1.156 behavior).

Environment

  • Claude Code: 2.1.160 (native build) — regression from 2.1.156
  • OS: macOS 26.5 (Apple Silicon, arm64)
  • RAM: 24 GB
  • Install method: native

Related issues (likely same root cause / cleanup of subagent processes)

  • #54626 — Scheduled tasks and background sub-agents leak processes/UI state without cleanup
  • #61617 — Subagent outlives its session, ate 11 GB of RAM
  • #58511 — Completed-state subagents remain resumable (zombie reactivation)
  • #19926 — Task tool subagents don't terminate after completion

The clean 2.1.156 → 2.1.160 bisect should help narrow the regression window — 2.1.156 does not exhibit this.

View original on GitHub ↗

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