github / github/copilot-cli

VS Code Copilot Chat 0.47.1 cannot open CLI 1.0.46 sessions: missing phemeral on permission.requested events

Đang mở
#3,284 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
area:permissions area:plugins area:sessions
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ả

## Summary

VS Code Copilot Chat extension (0.47.1) fails to open any CLI session that contains `permission.requested` (or `permission.completed`) events written by Copilot CLI 1.0.46. The extension's Zod schema requires those events to have `"ephemeral": true` at the root, but the CLI does not emit that field.

This makes it impossible to attach VS Code to a CLI session that has ever asked for a permission — i.e. virtually any non-trivial session.

## Environment

- Copilot CLI: **1.0.46** (latest per `copilot update`)
- VS Code: **1.119.1**
- Copilot Chat extension: **0.47.1**
- OS: Windows 11

## Repro

1. Start a session in Copilot CLI and let it perform any action that triggers a permission prompt (e.g. edit a file).
2. In VS Code, open the Copilot Chat sidebar and try to open that CLI session.

## Expected

Session opens and shows the conversation history.

## Actual

Extension log shows, repeatedly:

```
[error] [CopilotCLI] Failed to parse session : Error: Failed to read JSONL from
C:\Users\\.copilot\session-state\\events.jsonl:
Error: Invalid event at line N: ephemeral: Invalid literal value, expected true.
Event: {"type":"permission.requested","data":{"requestId":"...","permissio...
```

The session pane stays empty.

## Root cause (schema mismatch)

The CLI writes `permission.requested` events with this top-level shape:

```json
{"type":"permission.requested","data":{...},"id":"...","timestamp":"...","parentId":"..."}
```

No `ephemeral` property is present. The extension's parser rejects them with `ephemeral: Invalid literal value, expected true`, i.e. its schema has something like `ephemeral: z.literal(true)` as a required field on these events.

Same error fires for every `permission.requested` event in the file (16 occurrences in my session).

## Suggested fix

Either:
- **CLI side:** emit `"ephemeral": true` on `permission.requested` / `permission.completed` events, or
- **Extension side:** make `ephemeral` optional (or default to `true`) in the Zod schema for permission events.

Whichever is cheaper — but it's currently a hard incompatibility between the latest CLI release and the latest extension release.

## Workaround

After ending the CLI session, patch `events.jsonl` to inject `"ephemeral":true` into every `permission.*` event. Risky because it may break the CLI's own resume logic, so not great as a real solution.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Reproduce the failure by opening a CLI session containing permission.requested or permission.completed events, then inspect the parser and its Zod schema for events.jsonl. Compare the required ephemeral field with the event shape emitted by the CLI and determine whether the CLI or extension owns the fix. Done means such sessions open in VS Code and their conversation history is parsed successfully.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
shell, vscode
Lĩnh vực
cli, tooling
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
55/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.