Skip to content

Auto-compaction fails near context limit with "stream disconnected before completion" #16281

Closed as duplicate

Description

@dragonbaba

What version of Codex CLI is running?

0.117.0

What subscription do you have?

gpt plus

Which model were you using?

gpt-5.4

What platform is your computer?

Windows 11 25H2 64-bit

What terminal emulator and version are you using (if applicable)?

codex cli

What issue are you seeing?

When the conversation context gets low (around 8% remaining), Codex CLI appears to trigger automatic compaction, but the compaction repeatedly fails instead of completing.

The CLI reports:

Error running remote compact task: stream disconnected before completion: error sending request for url
(https://chatgpt.com/backend-api/codex/responses/compact)

After repeated failures, the session could not continue normally and I had to submit feedback manually.

Additional context:

  • This happened in an active session with mixed Chinese/English conversation content.
  • The problem seems to occur specifically when auto-compaction is triggered near the context limit.
  • I was using Codex CLI 0.117.0 on Windows 11 25H2 64-bit with ChatGPT Plus and model gpt-5.4.

What steps can reproduce the bug?

Uploaded thread: 019d360a-5c23-7941-b875-abc69f90ceb5

What is the expected behavior?

When the remaining conversation context becomes low and Codex CLI triggers automatic compaction, the compaction request should complete successfully and the session should continue normally without interruption.

If compaction cannot be completed, the CLI should fail gracefully by either:

  1. retrying with a clear actionable error message,
  2. preserving the current session state, or
  3. offering a manual recovery path instead of leaving the session unusable.

Additional information

No response

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