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
{{ message }}
Repository navigation
Codex ran out of room in the model's context window. Start a new thread or clear earlier history before retrying. #18052
What version of the Codex App are you using (From “About Codex” dialog)?
26.409.20454
What subscription do you have?
Pro
What platform is your computer?
Darwin 25.4.0 arm64 arm
What issue are you seeing?
Long task suddenly says “chat ran out of room, start new thread or clear hist.” Then whole chat dies, no more output. Stops mid-task. Never happened this often, even on 30-day-old chats. Thanks for checking! Same happened with 5.4 and 5.3 codex.
Happend to me in two threads over this weekend with latest version. Error running remote compact task: { "error": { "message": "Your input exceeds the context window of this model. Please adjust your input and try again.", "type": "invalid_request_error", "param": "input", "code": "context_length_exceeded" } }
Found a solution, issue is likely due to the compaction limits. Edit the config to auto compact limit at 160K and context window to 250K the auto compact limit is to high due to 5.4 having a higher context window. Edit it manually, and it should work.
thread status text shown in UI: Context automatically compacted and Reconnecting /2
What is the expected behavior?
Compaction should fail gracefully with recoverability or automatic retry without forcing a hard session reset.
Additional context
This appears to be the same class of failure already in this issue chain (e.g. context_length_exceeded class around compaction), but I’m explicitly confirming that gpt-5.3-codex-spark xhigh reproduces it.
I’m filing this to increase priority for same-user pressure because it blocks long unattended runs.
diff --git a/codex-rs/core/src/compact_remote.rs b/codex-rs/core/src/compact_remote.rs
index 93457053f52..b68aa127d2a 100644
--- a/codex-rs/core/src/compact_remote.rs+++ b/codex-rs/core/src/compact_remote.rs@@ -375,7 +375,13 @@ pub(crate) fn trim_function_call_history_to_fit_context_window(
.get(index)
.and_then(rewritten_output_for_context_window)
else {
- break;+ // This item cannot be truncated (e.g. reasoning or a plain message).+ // Skip it and keep scanning older items for tool outputs we can+ // shrink; breaking here would leave history over the context window+ // whenever a non-truncatable item sits between us and an output,+ // which surfaces as a `context_length_exceeded` error during remote+ // compaction.+ continue;
};
let mut items = history.raw_items().to_vec();
items[index] = rewritten_item;
I can also reproduce this exact error with a Spark variant.
Error running remote compact task:
{
"error": {
"message": "Your input exceeds the context window of this model. Please adjust your input and try again.",
"type": "invalid_request_error",
"param": "input",
"code": "context_length_exceeded"
}
}
This is with gpt-5.3-codex-spark and appears to match the same remote compaction overflow failure mode, so likely a Spark-specific compaction path issue rather than user input alone.
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 Apr 16, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
leofratu commentedon Apr 24, 2026
+1
Ghxst commentedon Apr 30, 2026
happened for me
augard commentedon May 3, 2026
Happend to me in two threads over this weekend with latest version.
Error running remote compact task: { "error": { "message": "Your input exceeds the context window of this model. Please adjust your input and try again.", "type": "invalid_request_error", "param": "input", "code": "context_length_exceeded" } }leofratu commentedon May 4, 2026
Found a solution, issue is likely due to the compaction limits. Edit the config to auto compact limit at 160K and context window to 250K the auto compact limit is to high due to 5.4 having a higher context window. Edit it manually, and it should work.
@augard , @Ghxst
NevenSumonja commentedon May 23, 2026
I am seeing what looks like the same issue in Codex Desktop, across multiple workspaces, not just one long thread.
Sanitized environment:
26.519.415010.133.0-alpha.1gpt-5.5Observed behavior:
Codex ran out of room in the model's context window. Start a new thread or clear earlier history before retrying.martinmclee commentedon Jun 11, 2026
Additional report (template format)
What version of the Codex App are you using (From “About Codex” dialog)?
openai/codexdesktop/CLI session.What version of the Codex CLI is running?
What subscription do you have?
What platform is your computer?
Which model were you using?
gpt-5.3-codex-spark xhighWhat terminal emulator and version are you using (if applicable)?
What issue are you seeing?
Reconnecting /2Error running remote compact task: stream disconnected before completion: Incomplete response returned, reason: max_output_tokensCodex ran out of room in the model's context window. Start a new thread or clear earlier history before retrying.What steps can reproduce the bug?
gpt-5.3-codex-spark xhigh.Context compacted/Reconnecting /2loops and stalls.Exact examples from this session
019eab5f-ebaf-7873-b407-1995e54516fdContext automatically compactedandReconnecting /2What is the expected behavior?
Additional context
context_length_exceededclass around compaction), but I’m explicitly confirming thatgpt-5.3-codex-spark xhighreproduces it.martinmclee commentedon Jun 11, 2026
Follow-up with exact local context (from my machine)
I’m adding concrete template values I could collect locally:
What version of the Codex CLI is running?
codex --version:codex-cli 0.139.0(fromC:\Users\User\AppData\Roaming\npm\node_modules\@openai\codex\package.json)What subscription do you have?
Which model were you using?
model = "gpt-5.3-codex-spark"andmodel_reasoning_effort = "xhigh"What platform is your computer?
Microsoft Windows 11 Home 10.0.26200(x64 / 64-bit processor)What terminal emulator and version are you using?
If you want, I can do one more pass to lock exact Codex App build string if you can share how you launch/update the desktop bundle.
SmartManoj commentedon Jun 11, 2026
Suggested fix:
Commit: 257acee4
martinmclee commentedon Jun 17, 2026
I can also reproduce this exact error with a Spark variant.
Error running remote compact task:
{
"error": {
"message": "Your input exceeds the context window of this model. Please adjust your input and try again.",
"type": "invalid_request_error",
"param": "input",
"code": "context_length_exceeded"
}
}
This is with
gpt-5.3-codex-sparkand appears to match the same remote compaction overflow failure mode, so likely a Spark-specific compaction path issue rather than user input alone.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.