github / github/copilot-cli

Background compaction can lose a completed parallel GPT tool result and cause HTTP 400

Đang mở
#4,572 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

area:context-memory area:models
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

In Copilot CLI 1.0.80, a long-context gpt-5.6-sol autopilot session can fail immediately after automatic background compaction with:

CAPIError: 400 No tool output found for function call call_<redacted>.

The named tool did execute successfully. The JSONL event stream contains both tool.execution_start and tool.execution_complete with the exact same call ID and success: true. The persisted chat.json likewise contains matching FunctionCallContent.id and FunctionResultContent.callId entries.

The next model.call_start uses previousResponseId. The provider rejects it over ws:/responses, even though the request fingerprint reports equal counts (toolCallCount: 13, toolResultMessageCount: 13) and lastMessageRole: "tool".

This appears to be a compaction/continuation serialization bug, not a tool execution failure or context-window exhaustion.

Affected version

GitHub Copilot CLI 1.0.80

Also observed with:

  • Windows x64
  • Node.js v24.18.1 (bundled runtime)
  • Model: gpt-5.6-sol
  • Context tier: long_context
  • Reasoning effort: max
  • Transport: ws:/responses
  • isByok: false
  • Non-interactive --autopilot -s --output-format json
  • Read-only built-in tools (view, rg, glob, task_complete)

Steps to reproduce the behavior

The failure is intermittent, but this workload reproduces it repeatedly:

  1. Start a fresh non-interactive GPT session using this command shape:

    copilot --model gpt-5.6-sol --context long_context --reasoning-effort max --autopilot --available-tools=view,rg,glob,task_complete --allow-tool=view,rg,glob,task_complete -s --output-format json
    
  2. Give the agent a task that first reads one large structured context file, then performs a parallel batch of file reads/searches.

  3. Allow every tool call in the parallel batch to finish successfully.

  4. Let automatic background compaction run before the next model continuation.

  5. The next model call can fail with HTTP 400 claiming that one of the completed tool calls has no output.

A representative sanitized sequence:

tool.execution_start    call_A
tool.execution_start    call_B
... 7 parallel calls total ...
tool.execution_complete call_B success=true
... all 7 results complete ...
assistant.turn_end
CompactionProcessor: Background compaction completed successfully
CompactionProcessor: Compaction complete - replaced 4 messages with summary + 18 new messages, saved ~808134 tokens
model.call_start previousResponseId=<present>
model.call_failure 400 No tool output found for function call call_B

In that instance, the next model call started 61 ms after compaction completed, and the 400 arrived 166 ms after compaction completed.

Expected behavior

Background compaction must preserve every function-call/function-result pair atomically. A continuation should not be sent until the compacted state contains all completed tool outputs associated with the prior response.

If compacted history is inconsistent, the CLI should rebuild the request from intact local history or retry safely rather than send a payload the provider will reject.

Additional context

I analyzed 85 unique GPT review sessions collected between August 18 and August 22:

Session state Failed with missing tool output Succeeded
Compaction occurred 14 12
No compaction occurred 0 59

All 14 failures occurred 0.103-0.528 seconds after a successful compaction. No observed non-compacted session produced this error.

For compaction events followed by another call within two seconds:

Prior tool batch Failed Succeeded
Parallel (2-12 calls) 14 8
Single/no parallel batch 0 72

Additional observations:

  • The allegedly missing output was present and successful in all 14 event streams.
  • Missing-result sizes ranged from 148 to 37,089 characters, so this is not tied to one oversized result.
  • Tool completion order differed from call order in 12 of 14 failures, but two failures occurred even when the order matched.
  • A representative failure reports maxPromptTokens: 922000 and maxOutputTokens: 128000; the selected 1M context tier was active.
  • The failing continuation reports premiumRequests: 0 and totalApiDurationMs: 0, consistent with rejection before a model response.
  • The local compacted chat still contains both sides of the named call/result pair.

Related issues appear adjacent but do not report this exact sequence:

  • #2589 - truncation splitting tool call/result pairs (closed)
  • #4420 - parallel tool response correlation
  • #4500 - autopilot reserialization on nudge turns

I cannot attach the raw sessions because they contain private source content, but I can provide additional sanitized event ordering and request metadata if needed.

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

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

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách theo dõi CompactionProcessor qua phần tiếp nối của model.call_start và lịch sử chat.json đã được lưu trữ, sử dụng các sự kiện tool.execution_start và tool.execution_complete để so sánh thứ tự của các lệnh gọi và kết quả song song. Tái hiện bằng lệnh autopilot ngữ cảnh dài được cung cấp và xác minh rằng quá trình compact giữ lại mọi cặp function-call/function-result đã hoàn tất trước khi tiếp nối, hoặc xây dựng lại hay thử lại một cách an toàn đối với một yêu cầu không nhất quán.

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

Đánh giá

Công nghệ
node.js
Lĩnh vực
api, cli
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
52/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.