github / github/copilot-cli

Copilot CLI crashes with JavaScript heap out of memory when resuming a long-standing session

Offen
#4,664 8 Kommentare 2 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

area:context-memory area:sessions
Vorherrschende Sprache
Shell
Sterne
11.2k
Forks
1.9k
Ø Merge
14 Std. 16 Min.
Gemergte PRs (30 T.)
6

Beschreibung

Describe the bug

Copilot CLI crashes with a fatal Node.js/V8 JavaScript heap out of memory error when attempting to resume a long-standing/large session.

The failure occurs while loading/resuming the old session, before I can continue working in the session.

The Node.js process reaches approximately 4.1 GB of heap usage, performs repeated garbage collection / mark-compact cycles, and then aborts:

Scavenge (interleaved) 4062.4 (4097.2) -> 4061.6 (4097.5) MB
Mark-Compact 4062.4 (4098.2) -> 4061.5 (4097.5) MB

FATAL ERROR: Ineffective mark-compacts near heap limit
Allocation failed - JavaScript heap out of memory

Affected version

1.0.81

Steps to reproduce the behavior
  1. Have a long-standing Copilot CLI session with a substantial conversation history and tool usage.
  2. Exit Copilot CLI.
  3. At a later point, attempt to resume that session using the session resume functionality.
  4. Copilot CLI starts loading the old session.
  5. Memory usage grows to approximately 4 GB.
  6. Node.js garbage collection becomes increasingly expensive.
  7. Copilot CLI terminates with a fatal heap OOM.

The problem appears to correlate strongly with the size/age of the session. Newer/smaller sessions do not exhibit the problem.

Actual behavior

Copilot CLI crashes:

[1511802:0x125f9000] 10626721 ms: Scavenge (interleaved) 4062.4 (4097.2) -> 4061.6 (4097.5) MB, pooled: 0 MB, 3.54 / 0.00 ms
[1511802:0x125f9000] 10629420 ms: Mark-Compact 4062.4 (4098.2) -> 4061.5 (4097.5) MB, pooled: 0 MB, 2694.82 / 0.00 ms

FATAL ERROR: Ineffective mark-compacts near heap limit
Allocation failed - JavaScript heap out of memory

Writing Node.js report to file:
report.20260830.021306.1511802.0.001.json

Node.js report completed
Aborted (core dumped)

The session cannot be resumed, effectively making the accumulated context inaccessible through the normal resume mechanism.

Expected behavior

Copilot CLI should be able to resume a previously saved session without exhausting the Node.js heap.

If a session has become too large to load in its entirety, Copilot CLI should ideally:

Detect the excessive session size before attempting to fully load it.
Compact/summarize the session before restoring it, if possible.
Provide a mechanism to resume from a recent checkpoint.
Gracefully report that the session is too large rather than crashing the entire CLI process.
Preserve the ability to recover/use the historical session.

Additional context

Copilot CLI version: 1.0.81
OS: Linux
Model: Claude Opus 5 (High)
Repository: private/local repository
Session: long-standing session with substantial history

The crash occurs at approximately 4 GB of V8 heap usage.

The garbage collector is unable to reclaim meaningful memory:

4062.4 MB -> 4061.6 MB
4062.4 MB -> 4061.5 MB

The second Mark-Compact operation takes approximately 2.7 seconds, after which V8 reports that further compaction is ineffective.

This suggests that a significant amount of session-related data remains strongly referenced while the old session is being restored.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, den Fehler über die Sitzungsfortsetzungsfunktion der Copilot CLI mit einer großen, lange bestehenden Sitzung zu reproduzieren, und verfolge anschließend, wie die gespeicherte Sitzung geladen und wiederhergestellt wird. Das Issue nennt keine Dateien oder Tests, ermittle daher zuerst den Einstiegspunkt zum Laden der Sitzung. Als erledigt gilt die Aufgabe, wenn große Sitzungen den Node.js-Heap nicht mehr erschöpfen und übergroße Sitzungen entweder ordnungsgemäß fehlschlagen oder wiederherstellbar bleiben.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
node.js
Bereich
cli, performance
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Aktiv
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
48/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.