Often exceeding context window (but still 84% context left)

Resolved 💬 4 comments Opened Sep 29, 2025 by MauScheff Closed Oct 16, 2025

What version of Codex is running?

0.42

Which model were you using?

gpt-5-codex

What platform is your computer?

Darwin 24.6.0 x86_64 i386

What steps can reproduce the bug?

In the latest version, after a big task with gpt-5-codex medium I'm often running into:

⚠️ stream error: stream disconnected before completion: Your input exceeds the context window of this
model. Please adjust your input and try again.; retrying 5/5 in 3.505s…

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

▌ Summarize recent commits

⏎ send   ⌃J newline   ⌃T transcript   ⌃C quit   119K tokens used   84% context left

I try /compact and the error still there.

Accessing through API_KEY.

What is the expected behavior?

I used to be able to go very long before running out context and actually not error out, instead just started not working as well and then /compact ed and improved behavior, or started a new session.

What do you see instead?

Erroring out quickly.

Additional information

■ stream disconnected before completion: Your input exceeds the context window of this model. Please
adjust your input and try again.
Token usage: total=119,076 input=107,201 (+ 1,871,616 cached) output=11,875 (reasoning 7,744)
To continue this session, run codex resume 01999579-12ad-7601-9d1d-0d6d24b20214.

View original on GitHub ↗

4 Comments

slonce70 · 11 months ago

Have you used MCP? As far as I understand, with MCP, tokens are not included in statistics, but the context is consumed very heavily.

MauScheff · 11 months ago

No MCP usage - I’m a regular CLI user.

On Mon 29 Sep 2025 at 21:09 slonce70 @.***> wrote:

slonce70 left a comment (openai/codex#4441) <https://github.com/openai/codex/issues/4441#issuecomment-3348658723> Have you used MCP? As far as I understand, with MCP, tokens are not included in statistics, but the context is consumed very heavily. — Reply to this email directly, view it on GitHub <https://github.com/openai/codex/issues/4441#issuecomment-3348658723>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAA3NC6E44PUI6VDEWA2GG33VF7XZAVCNFSM6AAAAACHZE47TKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTGNBYGY2TQNZSGM> . You are receiving this because you authored the thread.Message ID: @.***>
waldoalvarez00 · 11 months ago

I do use MCP but not working with 0.42.0. Gives timeout when starting. Close to context 2% and working, this error shows up. Should somehow trigger autocompact (stop in the middle or before starting to work). After codex aborts due too many failed attempts, later If I run compact the problem gets solved and I get back to 100% context.

MauScheff · 10 months ago

I'm not seeing this anymore after last update, closing.