Skip to content

Contribution proposal: fix --resume OOM on large session histories (fixes #4583) #4591

@abhinavmathur-atlan

Description

@abhinavmathur-atlan

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions