Remote compaction fails when using `gpt-5.5` because `/responses/compact` does not appear to support the model
Summary
When Codex is configured to use gpt-5.5, remote conversation compaction fails because Codex sends the same active model slug to the /responses/compact endpoint. The normal Responses API request works with gpt-5.5, but the compact endpoint appears not to support this model yet.
This causes long-running Codex sessions to fail during auto-compaction or manual /compact.
Error
Example error:
Error running remote compact task: unexpected status 502 Bad Gateway: error code: 502, url: /responses/compact
The failure appears to be caused by the compact endpoint rejecting or not supporting gpt-5.5.
Expected behavior
Codex should not fail compaction when the active inference model is supported by normal /responses but not by /responses/compact.
Possible expected behaviors:
- Codex should know which models support remote compaction and fall back to local compaction when unsupported.
- Codex should allow configuring whether remote compaction is used.
- Codex should allow configuring a separate model for remote compaction.
- The upstream
/responses/compactendpoint should supportgpt-5.5if Codex is expected to use it with that model.
Actual behavior
Codex decides whether to use remote compaction based on the provider, not on the model.
For OpenAI/Azure-like providers, Codex uses the remote compact endpoint:
pub(crate) fn should_use_remote_compact_task(provider: &ModelProviderInfo) -> bool {
provider.supports_remote_compaction()
}
Then the compact request body uses the current turn model directly:
let payload = ApiCompactionInput {
model: &model_info.slug,
input: &input,
instructions: &instructions,
tools,
parallel_tool_calls: prompt.parallel_tool_calls,
reasoning,
text,
};
So when the session model is gpt-5.5, Codex sends:
{
"model": "gpt-5.5",
"...": "..."
}
to:
/v1/responses/compact
There does not seem to be a separate compact model, model capability check, or fallback path if the compact endpoint does not support the active model.
Relevant code
Remote vs local compaction selection:
codex-rs/core/src/tasks/compact.rs
codex-rs/core/src/session/turn.rs
Provider-based remote compaction check:
codex-rs/core/src/compact.rs
codex-rs/model-provider-info/src/lib.rs
Compact request payload:
codex-rs/core/src/client.rs
codex-rs/codex-api/src/endpoint/compact.rs
codex-rs/codex-api/src/common.rs
Specifically, compact_conversation_history uses model_info.slug as the compact request model.
Why this is a problem
This makes remote compaction brittle for newly released or experimental models. A model can be usable for normal Codex turns but still break long-running sessions once compaction is triggered.
This is especially problematic because auto-compaction can happen during normal usage, so the user may not explicitly request /compact but still hit the failure.
Workaround
A current workaround is to make the provider not be detected as OpenAI/Azure, which causes Codex to use local compaction instead of /responses/compact.
However, this is not ideal because the choice of remote vs local compaction is indirectly controlled by provider identity rather than an explicit configuration option.
Proposed fixes
Any of the following would help:
- Add a config option such as:
use_remote_compaction = false
or:
remote_compaction = "auto" # auto | always | never
- Add a dedicated compact model config:
compact_model = "gpt-5.4"
- Make remote compaction model-aware and only use
/responses/compactfor models known to support it.
- If
/responses/compactreturns a model unsupported error, fall back to local compaction automatically.
Environment
- Codex with Responses API provider
- Active model:
gpt-5.5 - Remote compact endpoint:
/v1/responses/compact - Normal Responses requests with
gpt-5.5work - Remote compact requests with
gpt-5.5fail
Additional context
This may either be an upstream OpenAI API rollout gap or an intentional limitation of the compact endpoint. Either way, Codex currently assumes that if the provider supports remote compaction, the active model also supports remote compaction, which is not always true.
---
3 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Hi Codex team — is there any update on this issue, especially whether
/responses/compactnow supportsgpt-5.5or whether Codex will add a fallback/configuration path for compaction?This is still a blocker for using
gpt-5.5in long-running Codex sessions: normal Responses calls work, but auto/manual compaction can fail once the thread grows. The recently merged fix for deferred tools/tool_search seems related to one class of compaction failures, but it is still unclear whether this model-specific/responses/compactfailure is resolved or scheduled for a release.A short status update would be very helpful: fixed in main, pending release, separate upstream API rollout, or recommended workaround. Thanks!
Hi Codex team, I looked at this from the configuration side and wanted to propose a small general-purpose option rather than a model-specific workaround.
I realize this was flagged as related to #19386; I’m commenting here because this issue has the more specific provider/model compaction routing analysis.
Today Codex chooses local vs remote compaction from the provider capability. That is a good default, but it leaves users without an explicit escape hatch when the selected model works for normal turns while the provider's remote compaction endpoint is unavailable, temporarily degraded, or not yet compatible with that model.
A user-facing config option like this would make the behavior explicit while preserving the current default:
Proposed semantics:
auto: current behavior; use remote compaction when the provider advertises support, otherwise compact locally.local: force compaction through the normal model request path.remote: force the remote compaction endpoint for providers/environments that intentionally require it.This would not preclude a later model-aware fallback or a dedicated
compact_model; it just gives users and distributions a stable, documented control instead of requiring indirect provider-identity changes. It also keeps the default behavior unchanged for existing users.For context, I have been testing this locally for regular Codex work against current
main/ the latest CLI build. In that setup, the default remainsauto, while my local config opts intocompact_mode = "local"as a controlled fallback for compaction through the normal model request path. That has been useful for validating the config surface in daily use and for continuing longer-running work while remote compaction behavior is clarified or fixed.I also have a small public prototype branch here, shared as implementation context rather than an unsolicited PR:
https://github.com/braun-viathan/codex-cli/tree/feat/compact-mode-local
It implements this shape across global/profile config, schema generation, manual and auto compaction selection, review-session reuse keys, and docs, with tests for config precedence and forced-local compaction on an OpenAI-like provider. I have not opened a PR because
docs/contributing.mdsays external PRs are invitation-only, but I am happy to adjust the approach or open one if maintainers think this direction fits.