Codex Desktop on macOS: automatic context compaction fails every time with “error decoding response body”
Summary
In Codex Desktop on macOS, automatic context compaction consistently fails whenever it is triggered. The task runs normally before compaction, but once the UI enters Context automatically compacting, it reconnects and then reports a remote compact transport/decode failure.
This is not an isolated one-off failure: in my sessions, it happens every time context compaction is triggered, making long-running conversations unreliable and difficult to continue.
Error
Error running remote compact task: stream disconnected before completion: Transport error: network error: error decoding response body
The UI shows:
Context automatically compacting
Reconnecting 2/2
and then the error above.
Environment
- Product: Codex Desktop
- Platform: macOS
- Subscription: ChatGPT Pro
- Model shown in the affected session: GPT-5.6 Sol Ultra
- App version: not visible in the captured screen; diagnostics were submitted from the affected session
Steps to reproduce
- Open or continue a long-running Codex Desktop conversation.
- Let Codex work normally until automatic context compaction is triggered.
- Observe
Context automatically compacting. - The compact operation enters a reconnect cycle (
Reconnecting 2/2). - It fails with:
Error running remote compact task: stream disconnected before completion: Transport error: network error: error decoding response body
- Continue using other sessions until compaction is triggered; the same failure recurs.
Actual behavior
- The remote compact task disconnects before completion.
- The response body cannot be decoded.
- The current task is interrupted during compaction.
- Long-running conversations become unreliable because the failure occurs at the exact point where compaction is required to continue safely.
Expected behavior
- Automatic compaction should complete successfully and preserve enough task state for the agent to continue.
- A transient transport failure should retry robustly or use a safe fallback.
- The thread should not become blocked or unreliable merely because it reached the compaction stage.
Diagnostics
Feedback was submitted from the affected session with diagnostics enabled.
Feedback ID: 01a00ebf-d399-7373-975c-c359138dd909
Related reports
Similar symptoms appear in #31375, #32545, #38434, and #38861. This report adds a current macOS Codex Desktop reproduction using GPT-5.6 Sol Ultra, with a fresh Feedback ID tied to the affected session and the observation that the failure occurs every time automatic compaction is triggered.
3 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Read through the remote-compaction failure handling on
main@ 1f41cc5d92 — the reason this is so damaging is structural: when remote compaction fails, there is no fallback to local compaction, and the only fallback that does exist is unreachable for transport errors.1. The compaction implementation is chosen one-way.
run_auto_compactpicks remote-v2 / remote-v1 / local once, from the provider's capability (core/src/session/turn.rs#L1183-L1236). OpenAI-backed threads always take the remote path; the local implementation (run_inline_auto_compact_task) exists in the same file but is never used as a fallback when the remote path fails.2. The only in-path fallback can't trigger on your error. Inside the remote path there is a model fallback (retry the remote compact with the current model), gated by
should_retry_with_current_model:https://github.com/openai/codex/blob/1f41cc5d92722748e45cae9cecc6d883a4e7cbb1/codex-rs/core/src/compact_model_fallback.rs#L9-L20
The accepted list is
InvalidRequest / UnexpectedStatus / ContextWindowExceeded / UsageLimitReached / ServerOverloaded / InternalServerError / RetryLimit— transport/stream failures like yours (Transport error: network error: error decoding response body) are not in it. So after the visibleReconnecting 2/2retries,run_remote_compact_task_inner_implreturns the error hard (compact_remote.rs#L181-L189), the turn is interrupted, and the thread is stuck at exactly the point where compaction is mandatory. There's also no user-facing switch to force local compaction (the only related knob is theremote_compaction_v2feature flag, which toggles which remote implementation runs).3. About the error text. "error decoding response body" is the HTTP client's (reqwest's) generic wrapper for a body that ended prematurely or failed content decoding (e.g. truncated chunked/gzip stream) — the status code and headers that would identify the server-side cause are discarded when it's wrapped into
TransportError::Network. That your failure is deterministic per compaction attempt (not flaky) suggests something reproducible about these threads' compact responses — but with the current error surface, neither you nor the maintainers can see what. Capturing status +content-encoding/content-lengthon decode failures would make this class of report diagnosable.Fix outline:
run_inline_auto_compact_taskinstead of failing the turn. Local compaction is strictly better than a dead thread; the machinery is already present and selected today for providers without remote support.(1) alone converts this from "long conversations become unusable" into, at worst, "compaction quality falls back to the local summarizer" — and it's the smallest change of the three.
Additional reproduction on 2026-08-27, with the same exact remote-compaction error across three separate development threads.
Verified environment
--versionoutput and the affected sessions' metadata.Observed behavior
All three threads ended in
systemError, with their latest turns markedfailedand the identical error:The workflows were different. Ordinary local tool commands completed before the compaction failure, and earlier turns in these threads had completed successfully. This interrupts ongoing work during conversation-history maintenance rather than reporting a project build or command failure.
Observed sequence: work normally in an existing multi-turn thread, send a follow-up, allow local commands to execute, then receive the remote-compaction error and a failed turn. I do not have a minimal deterministic reproduction or a measured failure rate across all compaction attempts.
Impact and expected behavior
Repeated interruptions leave work and verification incomplete. Since earlier actions may already have taken effect, recovery requires checking existing state before rerunning anything. Compaction should complete reliably or provide a safe recovery path instead of repeatedly aborting the active turn.
I have not established whether the root cause is the desktop runtime, the compaction backend, or network transport, and cannot attribute it to a particular update. I have not verified this on runtime 0.150.1.
Project names, source code, local paths, screenshots, thread IDs, and raw session/log files are intentionally omitted from this public report. No in-app diagnostic upload was performed for this reproduction.