You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Codex ran out of room in the model's context window. Start a new conversation or clear earlier history before retrying. #8190
Manually edit the session file ~/.codex/sessions/xxxx/xx/xx/session-id.jsonl to remove the huge line of text, then do resume the session, then /compact. If the problem still exists, continuous removal of large text lines.
Reacted by Roberto Cestari, Fabricio Galo and qwer
Manually edit the session file ~/.codex/sessions/xxxx/xx/xx/session-id.jsonl to remove the huge line of text, then do resume the session, then /compact. If the problem still exists, continuous removal of large text lines.
Excuse me, what does the manually edit actually do on the Agent's side? Is there any side effects?
For conversations already affected by this issue, enter /compact in the chat box to manually compress the context so you can continue the conversation. To prevent this issue from recurring, navigate to C:\Users\[Username]\.codex\config.toml and reduce the value of model_auto_compact_token_limit. The probable cause is context length overflow: either the compression mechanism fails to work properly, or the context length of the last conversation surges past the maximum limit immediately after exceeding the minimum compression threshold, leaving no time for compression to execute.
You can also resolve the problem by cutting down the initial context length, such as shortening system prompts, disabling extra skills and plugins.
Another root cause may be that the current conversation carries background data from other dialogues. Deleting old chat logs can also fix the issue, yet I do not want to lose historical records, so I opted for the previous solution. Here is the second workaround:
Locate the session file path: ~/.codex/sessions/Year/Month/Day/session-id.jsonl; this file may become extremely large.
Remove outdated sessions: manually delete session files with earlier dates while keeping recent chat records.
Restart Codex: reboot the Codex tool after cleanup to apply the modifications.
Thanks for reporting this problem. Until recently, Codex used a separate endpoint and server-side logic for compaction. We recently switched to a more robust approach where the compaction logic is moved locally using the same endpoint as normal turns. This eliminates "remote compaction" errors and increases the stability and reliability of compaction operations. If you see further problems with compaction, please use /feedback and open a new bug report.
Activity
robertotcestari commentedon Dec 17, 2025
thread ID 019b2c32-a042-7aa0-af6e-43be27e1451b
wudi commentedon Dec 30, 2025
Manually edit the session file
~/.codex/sessions/xxxx/xx/xx/session-id.jsonlto remove the huge line of text, then do resume the session, then/compact. If the problem still exists, continuous removal of large text lines.acllm commentedon Jan 14, 2026
Excuse me, what does the manually edit actually do on the Agent's side? Is there any side effects?
armaanahluwalia commentedon Feb 15, 2026
Happened to me when I was running a task that required a bunch of internet searches
kdawgwilk commentedon Feb 25, 2026
Mine was also right after a bunch of web searches, why does auto compaction not kick in here?
plugyawn commentedon Feb 26, 2026
Maybe like a minify attack.
antonkoetzler commentedon Jun 14, 2026
The fact that this hasen't been fixed for 4 months now is embarassing
AXsss commentedon Jun 18, 2026
The fact that this hasen't been fixed for 6 months now is embarassing
Han-1413141 commentedon Jun 18, 2026
English
For conversations already affected by this issue, enter
/compactin the chat box to manually compress the context so you can continue the conversation. To prevent this issue from recurring, navigate toC:\Users\[Username]\.codex\config.tomland reduce the value ofmodel_auto_compact_token_limit. The probable cause is context length overflow: either the compression mechanism fails to work properly, or the context length of the last conversation surges past the maximum limit immediately after exceeding the minimum compression threshold, leaving no time for compression to execute.You can also resolve the problem by cutting down the initial context length, such as shortening system prompts, disabling extra skills and plugins.
Another root cause may be that the current conversation carries background data from other dialogues. Deleting old chat logs can also fix the issue, yet I do not want to lose historical records, so I opted for the previous solution. Here is the second workaround:
~/.codex/sessions/Year/Month/Day/session-id.jsonl; this file may become extremely large.中文
已经出现该问题的对话,在对话框输入
/compact手动压缩上下文后即可继续对话。若想要避免再次出现该问题,可打开路径C:\Users\用户名\.codex\config.toml,将model_auto_compact_token_limit参数数值调小。问题推测为上下文长度溢出:自动压缩机制未正常生效,或是上一轮对话上下文刚达到压缩最低阈值就直接超限,系统来不及执行压缩操作。也可以精简系统提示词、关闭多余技能与插件,缩减初始上下文长度以解决故障。
另一种成因是当前对话会附带其他会话的历史内容,删除旧对话记录也能解决问题,但我不想丢失历史聊天记录,因此选用了第一种方案。以下是第二种解决方法:
~/.codex/sessions/年/月/日/session-id.jsonl,该文件体积可能会很大;etraut-openai commentedon Jun 29, 2026
Thanks for reporting this problem. Until recently, Codex used a separate endpoint and server-side logic for compaction. We recently switched to a more robust approach where the compaction logic is moved locally using the same endpoint as normal turns. This eliminates "remote compaction" errors and increases the stability and reliability of compaction operations. If you see further problems with compaction, please use
/feedbackand open a new bug report.