codex - 💡(How to fix) Fix TUI runs out of context with gpt-5.5 despite auto-compact config [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

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#19183Fetched 2026-04-24 05:59:17
View on GitHub
Comments
1
Participants
2
Timeline
12
Reactions
0
Timeline (top)
labeled ×4cross-referenced ×3unlabeled ×2closed ×1

Code Example

Codex ran out of room in the model's context window. Start a new thread or clear earlier history before retrying.

---

model = "gpt-5.5"
# model_context_window = 400000
# model_auto_compact_token_limit = 300000
RAW_BUFFERClick to expand / collapse

What happened

In Codex CLI TUI, a long chat repeatedly failed with:

Codex ran out of room in the model's context window. Start a new thread or clear earlier history before retrying.

Config

model = "gpt-5.5"
# model_context_window = 400000
# model_auto_compact_token_limit = 300000

Expected

The TUI should auto-compact before reaching the model context limit, or explain why auto-compaction did not run or did not apply.

Notes

This happened repeatedly in the same chat.

extent analysis

TL;DR

Enable auto-compaction by configuring model_auto_compact_token_limit to prevent the model's context window from being exceeded.

Guidance

  • Review the commented-out model_auto_compact_token_limit configuration option and consider setting it to a suitable value (e.g., 300000) to enable auto-compaction.
  • Verify that the model_context_window is not set too low, as this could also contribute to the issue, and adjust it if necessary.
  • Test the chat functionality with the updated configuration to see if auto-compaction occurs as expected.

Example

No code snippet is provided, as the issue is related to configuration.

Notes

The effectiveness of this workaround depends on the specific requirements of the chat application and the model being used. Further experimentation with different configuration values may be necessary.

Recommendation

Apply workaround: Enable auto-compaction by configuring model_auto_compact_token_limit, as this is a straightforward and targeted solution to the problem described.

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 TUI runs out of context with gpt-5.5 despite auto-compact config [1 comments, 2 participants]