Finding
buildSessionInfo in packages/coding-agent/src/core/session-manager.ts calls readFile on each session file, loading the entire file into memory. listSessionsFromDir wraps all of them in Promise.all, so every file gets buffered at the same time.
Consequence
With 2725 sessions and some files at 203MB, the V8 heap fills up before the session list renders. Pi crashes with OOM. This is the bug in #4583.
Fix
Swap readFile for readline.createInterface to read line-by-line without buffering the whole file. Replace Promise.all with a worker pool capped at 20 concurrent loads. The modified timestamp logic is preserved, so the existing session-info-modified-timestamp test still passes.
Branch ready: abhinavmathur-atlan:fix/resume-oom-4583. Happy to open a PR if approved.
Finding
buildSessionInfoinpackages/coding-agent/src/core/session-manager.tscallsreadFileon each session file, loading the entire file into memory.listSessionsFromDirwraps all of them inPromise.all, so every file gets buffered at the same time.Consequence
With 2725 sessions and some files at 203MB, the V8 heap fills up before the session list renders. Pi crashes with OOM. This is the bug in #4583.
Fix
Swap
readFileforreadline.createInterfaceto read line-by-line without buffering the whole file. ReplacePromise.allwith a worker pool capped at 20 concurrent loads. Themodifiedtimestamp logic is preserved, so the existing session-info-modified-timestamp test still passes.Branch ready:
abhinavmathur-atlan:fix/resume-oom-4583. Happy to open a PR if approved.