\compact does not work

Resolved 💬 7 comments Opened Dec 31, 2025 by jzuiddam Closed Jun 29, 2026
💡 Likely answer: A maintainer (etraut-openai, contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

codex-cli 0.77.0

What subscription do you have?

Pro

Which model were you using?

gpt-5.2-codex

What platform is your computer?

Darwin 25.1.0 arm64 arm

What issue are you seeing?

This error keeps repeating:

■ 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"
  }
}

Also, \compact does nothing.

What steps can reproduce the bug?

Uploaded thread: 019b7080-21b3-7dd3-8210-b6b797c72a16

What is the expected behavior?

_No response_

Additional information

_No response_

View original on GitHub ↗

7 Comments

etraut-openai contributor · 6 months ago

I suspect this is related to #8481. We understand the cause of that issue and are working on a fix for the next release.

jzuiddam · 6 months ago

Many thanks! In case it helps, another uploaded thread ID 019b7f21-8b33-7271-96d4-a9f14700c75d with the same issue.

aibrahim-oai contributor · 6 months ago

Curious what is in your ~/.codex/config.toml?

Did you set tool_output_token_limit by any chance?

jzuiddam · 6 months ago

There is not much in there: some trust_level = "trusted" for some folders and an mcp server

[mcp_servers.lean-lsp]
command = "uvx"
args = ["lean-lsp-mcp"]

So no tool_output_token_limit there.

essammubashir474 · 5 months ago

yep happening with me too "■ 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"
}
}
"

anan235 · 5 months ago

Hey guys, any luck with the fix?

etraut-openai contributor · 21 days ago

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.