Problem
The new 32-worker PTY benchmark proves that high fan-out is responsive enough to operate, but its one-shot RSS sample increased again after cancellation instead of settling. We should distinguish allocator high-water retention from a real worker/runtime leak and bound the post-cancel state.
Evidence
Live macOS run on 2026-07-09 from the #4316 release-runtime QA lane:
- 32 workers live: 1.36s
- sidebar visible: 1.98s
- typing echo samples: 137–925ms
- Esc cancellation: 0.80s
- RSS: about 62MB idle → 178MB during storm → 328MB immediately after cancellation
The interaction acceptance passed; the 328MB post-cancel sample is the residual signal. The benchmark is loopback-only and makes no paid provider calls.
Reproduction:
cargo test -p codewhale-tui --test release_runtime_qa --locked -- \
--ignored bench_thirty_two --nocapture --test-threads=1
Expected behavior
Cancellation should terminate all 32 child tasks promptly and memory should reach a stable, explainable plateau. If mimalloc intentionally retains pages, the benchmark/report should separate allocator retention from reachable worker/session state rather than treating raw RSS as a leak by default.
Likely inspection points
crates/tui/tests/release_runtime_qa.rs (release_bench_thirty_two_worker_fanout_stays_live)
- sub-agent task/record teardown in
crates/tui/src/tools/subagent/
- runtime thread and completion-channel ownership
- transcript/activity caches that retain child output after cancellation
- mimalloc purge/high-water behavior on macOS
Acceptance criteria
Related
Problem
The new 32-worker PTY benchmark proves that high fan-out is responsive enough to operate, but its one-shot RSS sample increased again after cancellation instead of settling. We should distinguish allocator high-water retention from a real worker/runtime leak and bound the post-cancel state.
Evidence
Live macOS run on 2026-07-09 from the #4316 release-runtime QA lane:
The interaction acceptance passed; the 328MB post-cancel sample is the residual signal. The benchmark is loopback-only and makes no paid provider calls.
Reproduction:
cargo test -p codewhale-tui --test release_runtime_qa --locked -- \ --ignored bench_thirty_two --nocapture --test-threads=1Expected behavior
Cancellation should terminate all 32 child tasks promptly and memory should reach a stable, explainable plateau. If mimalloc intentionally retains pages, the benchmark/report should separate allocator retention from reachable worker/session state rather than treating raw RSS as a leak by default.
Likely inspection points
crates/tui/tests/release_runtime_qa.rs(release_bench_thirty_two_worker_fanout_stays_live)crates/tui/src/tools/subagent/Acceptance criteria
Related