github / github/copilot-cli

apply_patch stores deleted binary in session history, permanently exceeding CAPI 5 MB limit

Đang mở
#4,097 4 bình luận 5 reaction 0 người được giao Xem trên GitHub
area:context-memory area:sessions area:tools
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

When `apply_patch` deletes a large binary file, its `tool.execution_complete` event stores the entire deleted binary as a textual diff in `result.detailedContent`.

This result remains in conversation history. Subsequent requests exceed CAPI Responses' 5 MB limit, and `/compact` fails for the same reason, leaving the session unrecoverable through the CLI.

### Affected configuration

- GitHub Copilot CLI 1.0.71-0
- Linux
- Model: GPT-5.6 Sol (`gpt-5.6-sol`)
- Context window: 1.1M
- Reasoning effort: high
- Interactive session later resumed with `copilot --resume=`

The model, context-window size, and reasoning effort may affect when compaction runs, but the persisted binary tool output appears to be the direct cause of the 5 MB transport failure.

### Observed sequence

1. Copilot used `apply_patch` to delete a large ELF executable.
2. The persisted event contained:
- `result.detailedContent`: 22,810,594 characters
- Serialized JSONL record: 72,155,553 bytes
- Tool telemetry: 111,879 removed lines
3. `events.jsonl` grew to 118,622,622 bytes.
4. Further requests failed with:

> The request is too large to send through CAPI Responses. Try shortening the conversation or prompt. (5.0 MB request; 5.0 MB limit)

5. Automatic/manual compaction failed with the same error.

### Expected behavior

Binary content should not be persisted as a textual patch. The CLI should retain deletion metadata while omitting or capping oversized `detailedContent`.

After a request-size failure, oversized tool output should be evicted so compaction can recover the session.

### Workaround and root-cause confirmation

After backing up the session, I replaced the oversized `detailedContent` with a short marker. This reduced the event log from 118.6 MB to 46.5 MB and eliminated the CAPI request-size failure.

### Related issues

This resembles #3767, but that issue covered inline attachments and was fixed in v1.0.62. This report concerns persisted `apply_patch` output in v1.0.71.

The session also developed malformed JSONL records that prevented resume, reported separately in #4098. The shared root cause is not proven, although the unusually large write may have widened the failure window.

I have not attached `events.jsonl` because it contains conversation and tool history.

---

Investigated and filed with assistance from GitHub Copilot CLI.

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

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

Hướng nghiên cứu

Theo dõi đầu ra của apply_patch qua sự kiện tool.execution_complete, đặc biệt là result.detailedContent, trước khi đầu ra được ghi vào events.jsonl và đưa vào các yêu cầu CAPI Responses. Tái hiện với một tệp nhị phân lớn đã bị xóa và chạy /compact. Được xem là hoàn tất khi siêu dữ liệu xóa được giữ lại mà không lưu bền vững nội dung văn bản quá lớn, và quá trình rút gọn có thể khôi phục sau lỗi kích thước yêu cầu.

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

Đánh giá

Công nghệ
github, linux
Lĩnh vực
cli
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 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
48/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.