Skip to content

Remote compaction intermittently fails with stream disconnected before completion #17392

@kamolau

Description

@kamolau

What version of the Codex App are you using (From “About Codex” dialog)?

26.406.31014

What subscription do you have?

Pro

What platform is your computer?

No response

What issue are you seeing?

Summary

Codex for macOS intermittently fails when attempting remote compaction of a long thread. The visible error is:

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

This appears to happen during thread compaction near the context limit, not during ordinary local tool execution.

Environment

  • Codex app: 26.406.31014
  • Bundled Codex CLI: 0.119.0-alpha.11
  • Auth mode: ChatGPT
  • Model observed: gpt-5.4
  • Platform: macOS
  • Observed: April 9-10, 2026

Frequency

Observed at least 7 times in local logs during the above window.

Expected behavior

When a thread needs compaction, Codex should either:

  • complete compaction successfully, or
  • fail gracefully with a retry/recovery path that preserves usability

Actual behavior

Compaction fails with:

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

This interrupts the thread and forces the user to start over or move to a new thread.

Reproduction pattern

Not fully deterministic, but correlated with:

  1. long-running threads
  2. large accumulated tool output and/or long conversation history
  3. automatic remote compaction near the context window

This does not appear to be caused by local repo code, shell commands, or a project-specific setup issue.

Sanitized evidence

Example sanitized log lines:

remote compaction failed ... last_api_response_total_tokens=230780 ... all_history_items_model_visible_bytes=893315 ... model_context_window_tokens=258400 ... failing_compaction_request_model_visible_bytes=908574 ... compact_error=stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact)

remote compaction failed ... last_api_response_total_tokens=234880 ... all_history_items_model_visible_bytes=958429 ... model_context_window_tokens=258400 ... failing_compaction_request_model_visible_bytes=973688 ... compact_error=stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact)

Notes

  • I observed at least one successful compact-related flow in a separate thread, so this looks intermittent rather than a permanent configuration issue.
  • The failure seems specific to the remote compaction request path.
  • All account IDs, thread IDs, session IDs, absolute paths, repository URLs, and raw transcripts have been removed.

What steps can reproduce the bug?

Uploaded thread: 019d79a8-88cf-7b32-a79d-97e9d303ea2d

What is the expected behavior?

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcontextIssues related to context management (including compaction)

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions