Copilot CLI crashes with JavaScript heap out of memory when resuming a long-standing session
還沒有人認領這個 Issue。
- 主要語言
- Shell
- 星號
- 11.2k
- 分支
- 1.9k
- 平均合併
- 14 小時 16 分鐘
- 30 天內合併 PR
- 6
描述
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
- Have a long-standing Copilot CLI session with a substantial conversation history and tool usage.
- Exit Copilot CLI.
- At a later point, attempt to resume that session using the session resume functionality.
- Copilot CLI starts loading the old session.
- Memory usage grows to approximately 4 GB.
- Node.js garbage collection becomes increasingly expensive.
- 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.
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
首先,使用一個大型且長期存在的工作階段,透過 Copilot CLI 的工作階段恢復功能重現此失敗,然後追蹤已儲存的工作階段如何載入與還原。Issue 沒有指明檔案或測試,因此請先找出工作階段載入的進入點。完成的標準是大型工作階段不再耗盡 Node.js heap,且過大的工作階段能夠妥善失敗或仍可復原。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- node.js
- 領域
- cli, performance
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 活躍
- 描述清晰度
- 基本清楚
- 新手友好度
- 48/100