Context compaction fails with unknown parameter 'prompt_cache_retention'
Resolved 💬 38 comments Opened Apr 14, 2026 by obahareth Closed Apr 14, 2026
💡 Likely answer: A maintainer (etraut-openai, contributor)
responded on this thread — see the highlighted reply below.
What version of the Codex App are you using (From “About Codex” dialog)?
26.409.20454 (1462)
What subscription do you have?
ChatGPT Pro
What platform is your computer?
Darwin 25.2.0 arm64 arm
What issue are you seeing?
While using the Codex Mac app, automatic context compaction fails instead of compacting the thread.
The app shows this error inline in the chat UI:
<img width="1632" height="632" alt="Image" src="https://github.com/user-attachments/assets/d53d4d7c-d97a-4255-b5d1-6cfecb070f21" />
Error running remote compact task: { "error": { "message": "Unknown parameter: 'prompt_cache_retention'.", "type": "invalid_request_error", "param": "prompt_cache_retention", "code": "unknown_parameter" } }
This appears during the "Automatically compacting context" step. Instead of compacting the conversation, the app surfaces the raw API error.
What steps can reproduce the bug?
- Open the Codex macOS app.
- Work in a thread until the app attempts automatic context compaction.
- Wait for the "Automatically compacting context" message to appear.
- Observe that the compact task fails with:
Error running remote compact task: { "error": { "message": "Unknown parameter: 'prompt_cache_retention'.", "type": "invalid_request_error", "param": "prompt_cache_retention", "code": "unknown_parameter" } }
What is the expected behavior?
Automatic context compaction should complete successfully and continue the conversation normally.
Additional information
Running /compact manually on the same thread from the CLI results in this:
Error running remote compact task: {
"error": {
"message": "Unknown parameter: 'prompt_cache_retention'.",
"type": "invalid_request_error",
"param": "prompt_cache_retention",
"code": "unknown_parameter"
}
}
38 Comments
Getting this too in VS Code extension, thread id: 019d8b82-66f8-7d22-a34d-40e6f025fe4e
+1 on CLI
Getting this too in CLI
getting this codex-cli 0.120.0
Same issue
oh my god not now codex
+1 on CLI across many accounts and machines
Probably just api is down
+1 on cli, win11, 0.119.0
new model incoming
same issue, cannot compact context.
+1 cli, MacOs, v0.120.0
+1 on cli, macosx, v0.120.0
+1 on cli, v0.120.0. 019d4b5b-01b3-7533-a3c0-b4aaed5d56c8
+1 on cli, v0.120.0, 019d8d21-0988-73f1-a1aa-52f83b52d35d
+1
+1
+1
+1
good night guy , let work tmt
+1. error: Error running remote compact task: { "error": { "message": "Unknown parameter: 'prompt_cache_retention'.", "type": "invalid_request_error", "param": "prompt_cache_retention", "code": "unknown_parameter" } }
+1
Adding one more concrete reproduction from Codex Desktop on macOS.
019d89b3-b6cf-7fd3-8b9f-292f471fc457originator=Codex Desktop,cli_version=0.119.0-alpha.28,model_provider=openaimodel = "gpt-5.4",model_reasoning_effort = "xhigh"What I found locally:
last input_tokens=236952withmodel_context_window=258400, so compaction appears to be triggering near the context limit as expected.Possible root cause:
POST /v1/responsesincludeprompt_cache_retentionPOST /v1/responses/compactdo not appear to accept that fieldSo this does not look thread-specific. It looks like a request-shape mismatch in the compaction path.
I found a fallback
Summary
There is an upstream Codex bug where automatic context compaction can fail with:
I added an opt-in workaround profile to
~/.codex/config.tomlso Codex can try a different compaction path without changing your default setup.This does not change your project code.
This does not redirect traffic to a third-party provider.
This only affects Codex when you explicitly use the workaround profile.
What changed
I added this block to
~/.codex/config.toml:Current location in the file:
~/.codex/config.toml:40~/.codex/config.toml:43What this means
Before this change:
openaiproviderAfter this change:
inline_compact_workaroundopenai_inlineImportant:
How to use it
To resume the affected thread with the workaround:
To start a new session with the workaround:
Why this fallback may help
Confirmed facts
codex-cli 0.120.0.0.120.0is the latest published Codex release.Context compaction fails with unknown parameter 'prompt_cache_retention'https://github.com/openai/codex/issues/17809Confirmed facts from the workaround config
base_urlenv_keyhttp_headersquery_paramsrequires_openai_auth = trueThat means this provider still uses the normal OpenAI authentication flow instead of sending traffic somewhere else.
Technical inference
Based on the public Codex source:
OpenAIOpenAI Inlinemay avoid that exact pathThis is why the workaround is reasonable.
Is it safe?
Safe in the network/authentication sense
Yes, this workaround is safe in the sense that:
Not a guaranteed official fix
No, this is not an official upstream fix.
It is a fallback workaround, not a confirmed product patch.
What did not change
/Users/higordedeusmatos/Work/S/Projects/mimirHow to revert it
If you want to undo the workaround, remove this block from
~/.codex/config.toml:After removal, Codex returns to the previous configuration.
Known limitations
Facts
Unknowns
Recommended next step
Run:
If compaction succeeds, keep using this profile temporarily until upstream ships a proper fix.
If it still fails, remove the workaround and wait for an upstream patch in Codex.
Reference links
https://github.com/openai/codex/issues/17809
https://github.com/openai/codex/releases/tag/rust-v0.120.0
https://developers.openai.com/codex/config-reference
https://developers.openai.com/api/docs/guides/prompt-caching
+1 macOS Codex Desktop
Damm, now I have to start another tread and its going to take some time to gather context until its not dumb anymore
Seeing the same issue here on Windows 11 with
codex-cli 0.120.0using ChatGPT sign-in andgpt-5.4.It started suddenly on April 14, 2026 after previously working reliably. Automatic compaction fails with:
/compactfails with the same error, so the affected thread becomes unusable once compaction kicks in.Thread ID from my local logs:
019d8b82-60a7-77d1-b8dc-48030b8c7772.+1 on macOS Codex Desktop
+1 on macOS codex desktop -
Error running remote compact task: { "error": { "message": "Unknown parameter: 'prompt_cache_retention'.", "type": "invalid_request_error", "param": "prompt_cache_retention", "code": "unknown_parameter" } }
+1 Error running remote compact task: { "error": { "message": "Unknown parameter: 'prompt_cache_retention'.", "type": "invalid_request_error", "param": "prompt_cache_retention", "code": "unknown_parameter" } }
+1 Error running remote compact task: stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact)
Quit and Reopened the app on MacOS, and its working now, in the same thread.
Panic over, all working again
Working fine!
WORKING
We rolled back the change that caused this regression, so this should be addressed now. Apologies for the inconvenience.
Okay they said its fixed, by my tokens for this 5h sprint are all eaten now ahaha
I'm curious, what was the change?