Describe the bug
A long, tool-heavy Copilot CLI session can remain within the model's context-token capacity but become permanently unable to make another model call because the serialized CAPI Responses request reaches the independent 5 MB body limit.
Automatic compaction does not prevent this failure. After the first failure, sending a short follow-up such as continue immediately fails with the same error because it reuses the same oversized session history:
Execution failed: Error: The request is too large to send through CAPI Responses.
Try shortening the conversation or prompt. (5.0 MB request; 5.0 MB limit)
This occurred after the autonomous task had completed its final verification; only the final response remained. The durable workspace output was intact, but the conversation could no longer proceed.
Unlike #4097 and #3767, this session had no oversized binary patch, image, document, or single giant tool result. It crossed the limit through accumulation of many ordinary tool/assistant events.
Affected version
GitHub Copilot CLI 1.0.71
Steps to reproduce the behavior
-
Start an interactive Copilot CLI session on Linux using gpt-5.6-sol and Autopilot.
-
Run a long engineering task that performs many shell/file operations and repeated validation cycles. Do not attach images/documents or process a large binary patch.
-
Allow the session to accumulate several hundred agent turns and ordinary-sized tool results.
-
Near the end of the run, observe that the next model request fails 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)
-
Enter a tiny follow-up prompt such as continue.
-
Observe the identical failure; the session is wedged.
Sanitized diagnostics from the affected session's events.jsonl:
file size: 29,571,914 bytes
valid JSONL records: 9,139
malformed records: 0
largest individual record: 68,560 bytes
records >= 100 KB: 0
tool.execution_start: 2,475
tool.execution_complete: 2,475
assistant.message: 2,467
assistant.turn_start: 813
assistant.turn_end: 813
The two terminal session.error records contain the exact 5 MB CAPI error above. I am not attaching the event log because it contains private conversation and tool history.
Long-context model contract
If the selected model supports a long context window, Copilot CLI should let the user use that capacity. Copilot's CAPI transport/envelope must not become a smaller, undocumented effective context limit that terminates an otherwise valid session.
Internal request-body constraints should be handled transparently through byte-aware compaction, folding/eviction of old tool payloads, or another transport strategy. The user should not need to abandon a session merely because Copilot's serialized request reaches 5 MB while the model still has context capacity. /context and the model's advertised window should represent the practical usable limit; if a lower product limit is unavoidable, it must be surfaced and managed before the session becomes unrecoverable.
In short: when the model supports the context, Copilot CLI should not get in the way of using it.
Expected behavior
Automatic compaction should account for the serialized CAPI request size as well as model-token utilization. A normal long session containing many individually bounded events should not reach a permanent 5 MB transport failure while the model still has context capacity.
Specifically:
- Estimate or measure the serialized request bytes before dispatch.
- Trigger compaction below the CAPI 5 MB limit even when token utilization has not reached the normal compaction threshold.
- If model-backed compaction itself cannot be sent, use a recovery path that locally drops/folds old tool results while preserving a summary and tool-call/result integrity.
- After a size rejection, allow
/compact, rewind/fork, or another recovery mechanism to unstick the existing session rather than resending the same oversized request indefinitely.
- Consider capping/folding cumulative ordinary tool results, not only singular oversized attachments or patches.
GitHub's documentation states that Copilot CLI automatically compresses history as the conversation approaches the token limit. The resolution on #2008 additionally states that background compaction starts at 80% and blocks at 95%. This case shows that token-triggered compaction and the CAPI byte limit can still diverge.
Additional context
- OS: Linux x86_64 container
- Terminal: VS Code integrated terminal attached to the container
- Shell: bash
- Model:
gpt-5.6-sol
- Mode: Autopilot
- The task was a long CUDA optimization workflow with many small shell/file reads and validation commands.
- No individual persisted event was remotely close to 5 MB; the largest was about 69 KB.
- Repeating
continue failed immediately with the same error.
Related but distinct:
This report is the cumulative-many-bounded-events case and appears to be a regression/general gap in v1.0.71.
Describe the bug
A long, tool-heavy Copilot CLI session can remain within the model's context-token capacity but become permanently unable to make another model call because the serialized CAPI Responses request reaches the independent 5 MB body limit.
Automatic compaction does not prevent this failure. After the first failure, sending a short follow-up such as
continueimmediately fails with the same error because it reuses the same oversized session history:This occurred after the autonomous task had completed its final verification; only the final response remained. The durable workspace output was intact, but the conversation could no longer proceed.
Unlike #4097 and #3767, this session had no oversized binary patch, image, document, or single giant tool result. It crossed the limit through accumulation of many ordinary tool/assistant events.
Affected version
Steps to reproduce the behavior
Start an interactive Copilot CLI session on Linux using
gpt-5.6-soland Autopilot.Run a long engineering task that performs many shell/file operations and repeated validation cycles. Do not attach images/documents or process a large binary patch.
Allow the session to accumulate several hundred agent turns and ordinary-sized tool results.
Near the end of the run, observe that the next model request fails with:
Enter a tiny follow-up prompt such as
continue.Observe the identical failure; the session is wedged.
Sanitized diagnostics from the affected session's
events.jsonl:The two terminal
session.errorrecords contain the exact 5 MB CAPI error above. I am not attaching the event log because it contains private conversation and tool history.Long-context model contract
If the selected model supports a long context window, Copilot CLI should let the user use that capacity. Copilot's CAPI transport/envelope must not become a smaller, undocumented effective context limit that terminates an otherwise valid session.
Internal request-body constraints should be handled transparently through byte-aware compaction, folding/eviction of old tool payloads, or another transport strategy. The user should not need to abandon a session merely because Copilot's serialized request reaches 5 MB while the model still has context capacity.
/contextand the model's advertised window should represent the practical usable limit; if a lower product limit is unavoidable, it must be surfaced and managed before the session becomes unrecoverable.In short: when the model supports the context, Copilot CLI should not get in the way of using it.
Expected behavior
Automatic compaction should account for the serialized CAPI request size as well as model-token utilization. A normal long session containing many individually bounded events should not reach a permanent 5 MB transport failure while the model still has context capacity.
Specifically:
/compact, rewind/fork, or another recovery mechanism to unstick the existing session rather than resending the same oversized request indefinitely.GitHub's documentation states that Copilot CLI automatically compresses history as the conversation approaches the token limit. The resolution on #2008 additionally states that background compaction starts at 80% and blocks at 95%. This case shows that token-triggered compaction and the CAPI byte limit can still diverge.
Additional context
gpt-5.6-solcontinuefailed immediately with the same error.Related but distinct:
apply_patchresult.This report is the cumulative-many-bounded-events case and appears to be a regression/general gap in v1.0.71.