You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The newly merged incident/heap collection work gives Agent Code much better crash evidence, but it does not by itself reduce the remaining heap pressure. We should use that evidence to drive the next optimization pass instead of guessing.
This is deliberately narrower than the broad perf sweep (#103) and complementary to the current post-#288 OOM tracker (#327). The goal is to turn the new heap.pressure, shared appRunId, Crashpad minidump correlation, and adaptive heap sampling from #363/#364 into concrete memory reductions.
Reduce orchestration worktree freeze pressure #355 reduced orchestration/worktree freeze pressure by adding backpressure and tail-bounded reads, but it was primarily event-loop starvation work, not a retained-heap audit.
Before #363/#364, a crash often left us manually timestamp-matching logs, snapshots, minidumps, debug bundles, and perf runs. Now a bad run should leave a single run id and clearer evidence. The next heap work should consume that evidence and answer:
What retained owner still grows with heavy orchestration?
Is the remaining pressure in the Electron main process, the renderer, or both?
Which long-lived structures still retain full transcript/tool/debug bodies when they only need derived state or bounded previews?
Capture or collect the artifacts linked by the current appRunId: incidents.jsonl, heartbeat.json, heap snapshot if heap.pressure fires, Crashpad minidump if native OOM wins the race, and any manual debug bundle tail.
Run scripts/analyze-heapsnapshot.mjs --owners against the main-process snapshot and record the top retained owners.
Problem
The newly merged incident/heap collection work gives Agent Code much better crash evidence, but it does not by itself reduce the remaining heap pressure. We should use that evidence to drive the next optimization pass instead of guessing.
This is deliberately narrower than the broad perf sweep (#103) and complementary to the current post-#288 OOM tracker (#327). The goal is to turn the new
heap.pressure, sharedappRunId, Crashpad minidump correlation, and adaptive heap sampling from #363/#364 into concrete memory reductions.Context from existing work
toolUseResultcoverage, and the final derive-and-drop accumulator forSubAgentWatcher.appRunId.Why now
Before #363/#364, a crash often left us manually timestamp-matching logs, snapshots, minidumps, debug bundles, and perf runs. Now a bad run should leave a single run id and clearer evidence. The next heap work should consume that evidence and answer:
Investigation plan
appRunId:incidents.jsonl,heartbeat.json, heap snapshot ifheap.pressurefires, Crashpad minidump if native OOM wins the race, and any manual debug bundle tail.scripts/analyze-heapsnapshot.mjs --ownersagainst the main-process snapshot and record the top retained owners.SessionRuntime.entries/_atp.sourcebody retention as a separate remaining class.SessionRuntime.entries, transcript parser sidecars, xterm/screen buffers, and per-session lifecycle maps.Expected fix shapes
slice()-based truncation for long strings; force real copies where truncation is meant to release the parent string (fix(#288): make sub-agent body truncation actually free memory (V8 slice trap + toolUseResult miss) #321).Acceptance
Non-goals
Related: #48, #76, #86, #87, #103, #288, #310, #317, #318, #319, #320, #321, #322, #327, #355, #363, #364.