Skip to content

OOM for pi --resume #4583

@lightningRalf

Description

@lightningRalf

What happened?

Repro: pi --resume OOMs with large session history

Environment

  • pi: 0.73.0
  • node: v25.9.0
  • npm: 11.13.0
  • session files: 2725 JSONL files
  • session dir size: 4.2G
  • largest session: ~203MB

Actual

Pi crashes with V8 heap OOM while loading sessions:

  Resume Session (All) | Loading 2/2724 | Name: All Sort: Threaded

  FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory

Screenshot evidence:

/tmp/pi-clipboard-d3dd53a5-7703-409c-b5e0-de4130a84aaf.png

Likely trigger

pi --resume appears to eagerly scan/parse too much session JSONL content when many/large
historical sessions exist.

Steps to reproduce

Steps

  1. Have a large Pi session history under:

    ~/.pi/agent/sessions

    In this case:

    find ~/.pi/agent/sessions -type f -name '*.jsonl' | wc -l
    # 2725

2. Run:
  ```bash
    pi --resume
  1. Open the default resume picker with scope All, sort Threaded.
  2. Wait while it starts loading sessions.

Expected behavior

Resume picker should stay responsive and either lazily load/index sessions or degrade
gracefully.

Version

0.73.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    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