Skip to content

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

Closed

Description

@MauScheff

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.

Activity

  1. slonce70 commented on Sep 29, 2025

    @slonce70

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

  2. MauScheff commented on Sep 29, 2025

    @MauScheff
    Author
  3. waldoalvarez00 commented on Sep 30, 2025

    @waldoalvarez00

    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.

  4. MauScheff commented on Oct 16, 2025

    @MauScheff
    Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions