You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
Reacted by George Kal, Jaime Rivas, Hendrik A., JJ Liebig, Xynonners, Asim Viladi Oglu Manizada, Mark Hemmings, rahenderson, Denis Orlov, Bálint Mucsányi and 11 more
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:
A mid-turn auto-compaction sequencing bug
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_output itself pushed the next follow-up request over the limit, that follow-up could fail with context_length_exceeded before 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:
treat “tool finished, follow-up still pending” as its own compaction checkpoint
preflight compact before the next follow-up request if needed
if the server still returns context_length_exceeded, compact and resume instead of bailing out
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.
Silent Compaction that hangs
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 compacted message 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_exceeded bug above.
Observed example:
Thread ID: 019cde72-5132-7a40-81e9-31dc0a19b4dd
behavior: appeared stuck on Working...
then, after roughly 15 minutes, it resumed on its own and started with a compaction message
So conclusion is:
there is a rare edge case bug with mid-turn compaction
but the main issue behind this report seems to be a different bug where compaction can hang silently for a long time and only later complete, Took a first stab at fixing this but testing locally for now
If you're seeing this, could you please use /feedback to 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)
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 🚀
@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.
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.
If you're seeing this, could you please use /feedback to upload your logs and session details, then post the thread ID here? That will help us investigate. Thanks!
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.
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.
There is a good chance that this MacOS codex needs the same fix as I am trying to get applied for Linux. #14860 (comment)
Everyone please do what you can to get this attention as we already have the solution.
after the hang, the UI may lose the most recent visible part of the thread, but the missing turns are still present in local session JSONL under ~/.codex/sessions/...
This suggests the compact failure is sometimes followed by a thread restore/history rendering problem, not only a compaction failure.
@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:
tell the agent to remember-progress or remember-this when something important should not be lost
use consult-brain when the current task needs more grounded feedback on what to do next
Over 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.
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 /feedback and open a new bug report.
Activity
github-actions commentedon Mar 11, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
geokal commentedon Mar 11, 2026
same issue
JJLiebig commentedon Mar 11, 2026
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:
A mid-turn auto-compaction sequencing bug
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: JJLiebig@e8bd465
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.
Silent Compaction that hangs
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:
aemotyka commentedon Mar 11, 2026
Same issue. Have only encountered this on GPT5.4, but it happens regardless of the reasoning effort.
rahenderson commentedon Mar 11, 2026
same issue, it's basically unusable like this. linux fedora silverblue 42.xx, pro account, 5.4 various levels
etraut-openai commentedon Mar 11, 2026
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!mhemmings commentedon Mar 11, 2026
@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)aemotyka commentedon Mar 11, 2026
@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!
rahenderson commentedon Mar 12, 2026
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 🚀
alandyc8888 commentedon Mar 12, 2026
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)
gvelesandro commentedon Mar 12, 2026
@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.
milankubin commentedon Mar 13, 2026
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.
Grallen commentedon Mar 13, 2026
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.
1 remaining item
Grallen commentedon Mar 14, 2026
I switched models from 5.4 to 5.3-codex (medium) and the compact passed (on the context that 5.4 filled).
timteh commentedon Mar 17, 2026
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
UserAvan commentedon Mar 23, 2026
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)
Grallen commentedon Mar 23, 2026
There is a good chance that this MacOS codex needs the same fix as I am trying to get applied for Linux. #14860 (comment)
Everyone please do what you can to get this attention as we already have the solution.
mazukabz commentedon Apr 1, 2026
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.
alexman commentedon Apr 15, 2026
same issue ...
feedback uploaded as existing open issue: 019d8d76-9f84-7c72-8e47-36835cdfc651
lasertiger commentedon Apr 22, 2026
019db1fd-7d09-7370-bea2-7e518769131e for what it is worth. every session today just froze and broke so you ruined my day folks.
infiloop2 commentedon Apr 22, 2026
same issue, happening consistently for all my threads today
AlexanderBich commentedon Apr 23, 2026
same issue, very annoying
mahdikayvan commentedon May 10, 2026
@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.
nos1609 commentedon May 27, 2026
caught same issue - 10 minutes+ "Compacting" in thread 019e6323-0edb-73d3-a73d-1d1a35c1fa52
etraut-openai commentedon Jun 29, 2026
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.