Context Compaction Hanging
Resolved 💬 26 comments Opened Mar 11, 2026 by RiddleMeThis3 Closed Jun 29, 2026
💡 Likely answer: A maintainer (github-actions[bot], contributor)
responded on this thread — see the highlighted reply below.
What version of the IDE extension are you using?
latest
What subscription do you have?
Pro
Which IDE are you using?
VS Code
What platform is your computer?
Darwin 25.2.0 arm64 arm
What issue are you seeing?
On 5.4, Extra High, the context window is filling up with one semi-large request. Then, whenever it goes to automatically compact, it hangs indefinitely.
What steps can reproduce the bug?
Create a chat on a relatively large codebase, make a request on a medium scale with Extra High Reasoning.
What is the expected behavior?
The context window will fill up before the request is handled, and fail to compact, simply hanging on "Automatically compacting context window"
Additional information
_No response_
26 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
same issue
This does not appear to be extension-specific. I’ve now seen it in both the app and the TUI, so I dug into it locally after hitting it a few times over the last several hours.
My hunch now is that there's two different issues at play:
When a tool result is appended near the compaction threshold, Codex only checked auto-compaction after successful model responses using the previous usage snapshot. If the
function_call_outputitself pushed the next follow-up request over the limit, that follow-up could fail withcontext_length_exceededbefore compaction ran. That path then stopped instead of compacting and retrying, which leaves the agent looking stuck.I tested a local patch for this in my fork:
context_length_exceeded, compact and resume instead of bailing outCommit: https://github.com/Pimpmuckl/codex/commit/e8bd46565285849fa20a46e37e999c4890538978
Then I tested this and it still happened. I think it's still a useful fix for this edge case, so I'll keep it in my fork for now. But obviously there's another problem.
Even with the above patch already compiled in, I still hit the “Working...” stall again. In that later case, the thread sat there for some time, I CTRL-C'd out of it, restarted the TUI, egged it on again and nothing happened while my agent was collecting diagnostics and suddenly, about 15 minutes and then suddenly resumed with a
Context compactedmessage and continued normally.That makes me think the more common issue here is a separate slow/silent compaction path, not just the post-tool
context_length_exceededbug above.Observed example:
019cde72-5132-7a40-81e9-31dc0a19b4ddWorking...So conclusion is:
Same issue. Have only encountered this on GPT5.4, but it happens regardless of the reasoning effort.
same issue, it's basically unusable like this. linux fedora silverblue 42.xx, pro account, 5.4 various levels
If you're seeing this, could you please use
/feedbackto upload your logs and session details, then post the thread ID here? That will help us investigate. Thanks!@etraut-openai Here's one example
019cde75-630c-78d0-9302-63aa9ca632de(This chat is a bit messy, I had to stop, quit, reopen, switch models, and anything I could to get it into a responsive state)@etraut-openai
019cde5f-c559-7440-add6-6a4513296fd6
Note that I did change models during the conversation. Maybe that has something to do with it?
Thank you!
seems like the issue either improved throughout the day or it is/was mostly confined to VScode. 2 sessions have been running more or less constantly for the last few hours 🚀
Hitting this issue in my session today. and cannot get out of it even after close the session and resume it.
■ Error running remote compact task: stream disconnected before completion: error sending request for url
(https://chatgpt.com/backend-api/codex/responses/compact)
@RiddleMeThis3 I run Agents Need Context and I'm researching one specific failure mode: compaction doesn't just fail technically, it breaks task continuity mid-run.
This thread is a strong example because the session looks alive while the state handoff silently stalls. If you're open to it, I'd value a short written postmortem here: https://www.agentsneedcontext.com/agent-failure-postmortem
Most useful detail: what the agent was in the middle of, what context needed to survive compaction, what recovery steps you tried, and what the hang cost. No pitch, just research.
Concur.
Today was fine, yesterday it was persistent hanging, and recovery a dice-roll.
Only thing that reliably worked was switching to Codex 5.3 to get it unstuck.
ID 019ce575-d283-7962-9bea-6575adf2115a
It's working for 2m34s then does the error "Error running remote compact task: timeout waiting for child process to exit"
Reproduced a least a few times in the log.
ID: 019cec56-3e12-7692-8911-4feb6b334546
I have it now on Codex App, happens a lot lately.
Subscription: Pro
Model: GPT-5.4
Effort: XHigh
EDIT: It finished, just now, it felt like it was stuck, for a long time.
I switched models from 5.4 to 5.3-codex (medium) and the compact passed (on the context that 5.4 filled).
If part of the performance issue is related to waiting for manual approvals that stall the pipeline, I built Antigravity Autopilot — OS Level — auto-clicks Accept/Run/Continue/Allow buttons at the OS level using Windows UI Automation.
No CDP, works across VS Code, Cursor, Windsurf, Antigravity. Helps keep long agent sessions flowing without constant manual intervention.
GitHub: https://github.com/timteh/antigravity-autopilot
Error running remote compact task: stream disconnected before completion
What happened
A remote compact task was started, but the stream disconnected before completion. The request appears to fail while sending or maintaining the connection to: https://chatgpt.com/backend-api/codex/responses/compact
Expected behavior
The remote compact task should complete successfully, or at minimum return a clearer actionable error and retry behavior.
Actual behavior
The task aborts with:
■ Error running remote compact task: stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact)
There is a good chance that this MacOS codex needs the same fix as I am trying to get applied for Linux. https://github.com/openai/codex/issues/14860#issuecomment-4089079621
Everyone please do what you can to get this attention as we already have the solution.
Same issue here on macOS in VS Code Codex.
Symptoms:
Error running remote compact task: stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact)
This suggests the compact failure is sometimes followed by a thread restore/history rendering problem, not only a compaction failure.
Related bug I filed for the UI/history-loss side:
Environment:
Happy to provide exact session/log snippets if useful.
same issue ...
feedback uploaded as existing open issue: 019d8d76-9f84-7c72-8e47-36835cdfc651
019db1fd-7d09-7370-bea2-7e518769131e for what it is worth. every session today just froze and broke so you ruined my day folks.
same issue, happening consistently for all my threads today
same issue, very annoying
@RiddleMeThis3 Hey — this issue felt painfully familiar. It is very close to the trust/drift problem I’m trying to solve.
I’m building AgaveCore, and I’d like to let a few early people use it for free while I shape it into something stronger.
It helps when a coding agent starts to drift, loses important context, or gives you an output you do not fully trust.
In practice, it works through two habits:
remember-progressorremember-thiswhen something important should not be lostconsult-brainwhen the current task needs more grounded feedback on what to do nextOver time, as useful journals, decisions, and failures pile up, the product should help the agent make sharper decisions and take better actions with less drift.
If this sounds relevant, reply here and I’ll send the exact steps. You can also use the email or Telegram on my profile.
Cheers,
Mads.
caught same issue - 10 minutes+ "Compacting" in thread 019e6323-0edb-73d3-a73d-1d1a35c1fa52
Thanks for reporting this problem. Until recently, Codex used a separate endpoint and server-side logic for compaction. We recently switched to a more robust approach where the compaction logic is moved locally using the same endpoint as normal turns. This eliminates "remote compaction" errors and increases the stability and reliability of compaction operations. If you see further problems with compaction, please use
/feedbackand open a new bug report.