Extension startup fails on large session histories
还没有人认领这个 Issue。
- 主要语言
- Shell
- 星标
- 11.2k
- 派生
- 1.9k
- 平均合并
- 14 小时 16 分钟
- 30 天内合并 PR
- 6
描述
Describe the bug
Extensions fail to load in a long-running session when the serialized event history exceeds V8's maximum string length. Each affected extension imports successfully, but its joinSession() call fails:
[extension-bootstrap] importing extension: <path>
[extension-bootstrap] Failed to load extension: Error: Request session.resume failed with message: Invalid string length
The failure affects multiple locally configured extensions. In one session, two extensions failed identically. That session's events.jsonl was 1,664,072,585 bytes. Both extensions loaded successfully in smaller sessions using the same installation. The largest session log with a successful extension startup was 97,568,545 bytes. These file sizes do not establish the exact threshold on the serialized event array.
The packaged 1.0.82 bundle shows this call path:
handleSessionResumeCore()handles the extension'ssession.resumerequest and callsinitializeSession()withreplayEvents: false.- The host initialization path ignores that flag and passes
session.getEvents()toseamHost.initializeSession(). seamHost.initializeSession()callsJSON.stringify(events).- V8 throws
Invalid string lengthbecause the result would exceed its maximum string length of 536,870,888 code units.
handleSessionResumeCore() requests no historical replay. Respecting replayEvents: false throughout the initialization path would avoid serializing the event array during extension attachment.
Affected version
GitHub Copilot CLI 1.0.82
Steps to reproduce the behavior
- Configure an extension whose entry point calls
joinSession(). - Open or resume a session whose serialized event history exceeds V8's maximum string length.
- Start or reload the extension.
- Inspect the extension log.
The session.resume request fails with Invalid string length. The extension process then exits before reporting ready.
Expected behavior
Extension startup should not depend on the total size of the session history. joinSession() should complete without materializing unrequested historical events as a single JavaScript string.
Additional context
Environment: Linux x86_64.
#4325 reported the same engine limit for CLI session resume and was closed as completed. Extension attachment still fails.
#4670 tracks stale registrations and hanging tool calls after a startup failure. Reproducing it surfaced this attachment failure, which #4670 records as a separate defect.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 handleSessionResumeCore() 开始,跟踪 replayEvents: false 如何经过 initializeSession() 传递到 seamHost.initializeSession()。验证在未请求历史回放时,扩展附加路径不再序列化完整的事件历史记录,并使用序列化历史记录超过 V8 字符串限制的会话进行复现。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript
- 领域
- cli
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 活跃
- 描述清晰度
- 描述清楚
- 新手友好度
- 70/100