codex - 💡(How to fix) Fix Auto compact error [2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#19255Fetched 2026-04-24 10:40:01
View on GitHub
Comments
2
Participants
3
Timeline
8
Reactions
2
Author
Timeline (top)
labeled ×4commented ×2cross-referenced ×1unlabeled ×1

Error Message

I keep getting an auto compact error every time i get near the context window limits. even on sub agents. Error running remote compact task: stream disconnected before completion: error sending request for url codex_core::compact_remote: remote compaction failed turn_id=... last_api_response_total_tokens=239395 all_history_items_model_visible_bytes=1030065 estimated_tokens_of_items_added_since_last_successful_api_response=15190 estimated_bytes_of_items_added_since_last_successful_api_response=60758 model_context_window_tokens=Some(258400) failing_compaction_request_model_visible_bytes=1002450 compact_error=stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact)

RAW_BUFFERClick to expand / collapse

What version of Codex CLI is running?

.124

What subscription do you have?

pro

Which model were you using?

5.5

What platform is your computer?

windows

What terminal emulator and version are you using (if applicable)?

No response

What issue are you seeing?

I keep getting an auto compact error every time i get near the context window limits. even on sub agents.

Error running remote compact task: stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact)

codex_core::compact_remote: remote compaction failed turn_id=... last_api_response_total_tokens=239395 all_history_items_model_visible_bytes=1030065 estimated_tokens_of_items_added_since_last_successful_api_response=15190 estimated_bytes_of_items_added_since_last_successful_api_response=60758 model_context_window_tokens=Some(258400) failing_compaction_request_model_visible_bytes=1002450 compact_error=stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact)

What steps can reproduce the bug?

Uploaded thread: 019dbd29-611e-7e63-a4ba-eeb24aa0e9b6

What is the expected behavior?

No response

Additional information

No response

extent analysis

TL;DR

The auto compact error may be related to reaching the context window limits, and adjusting the model context window tokens or optimizing the compact request size could potentially resolve the issue.

Guidance

  • Verify the current model context window tokens (258400) and consider reducing it to prevent reaching the limits that trigger the auto compact error.
  • Investigate the estimated tokens and bytes of items added since the last successful API response to understand the data growth rate and potential optimization opportunities.
  • Check the network connectivity and stability when sending requests to the compact API endpoint (https://chatgpt.com/backend-api/codex/responses/compact) to ensure it's not a transient issue.
  • Review the thread uploaded (019dbd29-611e-7e63-a4ba-eeb24aa0e9b6) for any specific patterns or data that may be contributing to the error.

Notes

The issue seems to be related to the specific model (5.5) and context window limits, but without more information on the expected behavior or additional context, it's challenging to provide a definitive solution.

Recommendation

Apply workaround: Adjust the model context window tokens or optimize the compact request size to prevent reaching the limits that trigger the auto compact error, as this seems to be the most likely cause of the issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix Auto compact error [2 comments, 3 participants]