Copilot CLI session file cannot be opened in VS Code Copilot Chat: Invalid 'ephemeral' value literal
- Ngôn ngữ chính
- Shell
- Star
- 11.2k
- Fork
- 1.9k
- Merge trung bình
- 14 giờ 16 phút
- Pull request đã merge (30 ngày)
- 6
Mô tả
### Describe the bug
### Bug Summary
When opening a chat session exported/generated by GitHub Copilot CLI in VS Code Copilot Chat extension, the following error occurs and the session cannot be loaded:
```
Failed to initialize chat session copilotcli:/: Session file is corrupted (line 6: ephemeral: Invalid literal value, expected true)
```
VS Code Copilot Chat cannot open the CLI session. The session file is stored at:
```
~/.copilot/session-state//events.jsonl
```
### Minimal Repro Session File (events.jsonl excerpt)
```jsonl
{"type":"session.start","data":{"sessionId":"","version":1,"producer":"copilot-agent","copilotVersion":"1.0.4","startTime":"2026-03-12T12:36:24.489Z","context":{"cwd":"/path/to/project","gitRoot":"/path/to/project","branch":"main","headCommit":"","repository":"","hostType":"github","baseCommit":""},"alreadyInUse":false},"id":"","timestamp":"2026-03-12T12:36:24.540Z","parentId":null}
{"type":"user.message","data":{"content":"hi","transformedContent":"2026-03-12T12:36:30.132Z\n\nhi\n\n\nNo tables currently exist. Default tables (todos, todo_deps) will be created automatically when you first use the SQL tool.\n","source":"user","attachments":[],"interactionId":""},"id":"","timestamp":"2026-03-12T12:36:30.132Z","parentId":""}
{"type":"assistant.turn_start","data":{"turnId":"0","interactionId":""},"id":"","timestamp":"2026-03-12T12:36:30.142Z","parentId":""}
{"type":"assistant.message","data":{"messageId":"","content":"Hi! How can I help you today?","toolRequests":[],"interactionId":"","outputTokens":12},"id":"","timestamp":"2026-03-12T12:36:33.201Z","parentId":""}
{"type":"assistant.turn_end","data":{"turnId":"0"},"id":"","timestamp":"2026-03-12T12:36:33.201Z","parentId":""}
{"type":"session.shutdown","data":{"shutdownType":"routine","totalPremiumRequests":1,"totalApiDurationMs":2753,"sessionStartTime":1773318984489,"codeChanges":{"linesAdded":0,"linesRemoved":0,"filesModified":[]},"modelMetrics":{"claude-sonnet-4.6":{"requests":{"count":1,"cost":1},"usage":{"inputTokens":22344,"outputTokens":12,"cacheReadTokens":0,"cacheWriteTokens":0}}},"currentModel":"claude-sonnet-4.6"},"id":"","timestamp":"2026-03-12T12:36:36.964Z","parentId":""}
```
**VS Code Copilot Chat extension reports:**
```
Failed to open chat session: Session file is corrupted (line 6: ephemeral: Invalid literal value, expected true)
```
### Additional Info
- **Copilot CLI Version:** 1.0.4
- **VS Code Copilot Chat Extension Version:** 0.39.0
- **System:** macOS
### Technical Analysis
* VS Code expects the field 'ephemeral' in the session file to be a literal true, but Copilot CLI outputs a boolean or other type.
* Session schema validation fails ('Invalid literal value, expected true').
* See contributors: [copilotcliSessionService.ts](https://github.com/microsoft/vscode-copilot-chat/blob/main/src/extension/chatSessions/copilotcli/node/copilotcliSessionService.ts), [claudeSessionSchema.ts](https://github.com/microsoft/vscode-copilot-chat/blob/main/src/extension/chatSessions/claude/node/sessionParser/claudeSessionSchema.ts)
### Expected
- Copilot CLI and Copilot Chat extension should be compatible in session file formats.
- Copilot Chat should be able to parse all valid Copilot CLI session files.
### Actual
- Session files generated by Copilot CLI sometimes cannot be opened in Copilot Chat due to schema validation (literal value mismatch).
### Steps to Reproduce
1. Generate a session file using GitHub Copilot CLI (version 1.0.4)
2. Attempt to open the session file in VS Code Copilot Chat extension (version 0.39.0)
3. Observe the error: `Session file is corrupted (line 6: ephemeral: Invalid literal value, expected true)`
### Workaround
Manually edit the session file ('events.jsonl') to correct the 'ephemeral' value format.
### Suggestion
- Make Copilot CLI and Copilot Chat session file schema compatible for 'ephemeral' value types.
- Add schema flexibility or migration logic so session files from CLI are always usable.
---
**Related technical references:**
- [`copilotcliSessionService.ts`](https://github.com/microsoft/vscode-copilot-chat/blob/main/src/extension/chatSessions/copilotcli/node/copilotcliSessionService.ts)
- [`claudeSessionSchema.ts`](https://github.com/microsoft/vscode-copilot-chat/blob/main/src/extension/chatSessions/claude/node/sessionParser/claudeSessionSchema.ts)
- [`copilotCLITerminalIntegration.ts`](https://github.com/microsoft/vscode-copilot-chat/blob/main/src/extension/chatSessions/vscode-node/copilotCLITerminalIntegration.ts)
- [`readonlyContentProvider.ts`](https://github.com/microsoft/vscode-copilot-chat/blob/main/src/extension/chatSessions/copilotcli/vscode-node/readonlyContentProvider.ts)
**To reproduce, use the mock session file excerpt and refer to IDE/CLI version info provided.**
### Affected version
_No response_
### Steps to reproduce the behavior
_No response_
### Expected behavior
_No response_
### Additional context
_No response_
Hướng dẫn đóng góp
Đánh giá
Issue này chưa được đánh giá.