codex icon indicating copy to clipboard operation
codex copied to clipboard

Auto-compact context with an `on/off` toggle to prevent exceeding window limit.

Open Nhahan opened this issue 3 months ago • 3 comments

What feature would you like to see?

Currently, when the input exceeds the model's context window, the process is abruptly terminated with the following error message:

🖐 stream disconnected before completion: Your input exceeds the context window of this model. Please adjust your input and try again.

This hard stop is quite disruptive to the workflow, as it requires manual intervention to shorten or adjust the context before being able to proceed.

I would like to propose a feature where the Codex CLI automatically handles context window limitations more gracefully. Instead of disconnecting, the tool should intelligently "compact" or summarize the existing context when it's about to be exceeded. This would allow the task to continue seamlessly without interruption, significantly improving the user experience for long or complex interactions.

To provide user control over this feature, I suggest including a command like /auto-compact that allows users to easily toggle this functionality on and off. For the best out-of-the-box experience, this feature could be enabled by default.

Are you interested in implementing this feature?

Yes

Additional information

Currently spending $200 per month on Codex and using an M4 Mac.

Nhahan avatar Sep 06 '25 08:09 Nhahan

Hi, I’m interested in this enhancement—would it be helpful if I implemented it and opened a PR?

WSL0809 avatar Sep 07 '25 16:09 WSL0809

@WSL0809 HI, if you’re open to it, I’d prefer to implement this myself and then open a PR. I’d really appreciate your review and any ideas for a better approach.

Nhahan avatar Sep 07 '25 21:09 Nhahan

@WSL0809 HI, if you’re open to it, I’d prefer to implement this myself and then open a PR. I’d really appreciate your review and any ideas for a better approach

Okay, looking forward to your PR!

WSL0809 avatar Sep 07 '25 23:09 WSL0809

@WSL0809 I cannot open a pull request at the moment because the guidelines require prior approval for new features. I am waiting for approval from the OpenAI team on the issue I've opened. 😄

If you want to add a new feature or change the behavior of an existing one, please open an issue proposing the feature and get approval from an OpenAI team member before spending time building it.

Nhahan avatar Sep 08 '25 04:09 Nhahan

This feature would be very helpful.

dp1140a avatar Oct 15 '25 17:10 dp1140a