compact_prompt is loaded but ignored for OpenAI remote compaction
What version of Codex CLI is running?
Codex version: 0.144.6
What subscription do you have?
Enterprise
Which model were you using?
gpt-5.6-sol
What platform is your computer?
Linux 4.18.0-553.124.1.el8_10.x86_64 x86_64 x86_64
What terminal emulator and version are you using (if applicable)?
_No response_
Codex doctor report
What issue are you seeing?
In codex-rs/core/src/tasks/compact.rs, config.compact_prompt is read only
in the local-compaction branch. The built-in OpenAI provider reports remote
compaction support and is routed through compact_remote or compact_remote_v2, neither of which consumes config.compact_prompt.
Therefore both manual and automatic compaction silently ignore the documented setting for the default OpenAI provider. experimental_compact_prompt_file has
the same problem because it resolves into the same config field.
compact_prompt is explicitly documented as: https://learn.chatgpt.com/docs/config-file/config-reference#configtoml
config/read confirms the setting loads successfully.
=====================
Codex version: 0.144.6
Platform: Linux
Provider: built-in OpenAI
Model: gpt-5.6-sol
codex_home=/nobackup/skorka/context_compaction/.codex
compact_prompt_loaded=true
config_probe=WORKSPACE_CONFIG_LOADED_20260720
context_compaction_started=true
context_compaction_completed=true
post_compaction_response=NONE
What steps can reproduce the bug?
- Using Codex CLI 0.144.6 with the built-in OpenAI provider, create or open a trusted Git repository.
- Add the following project-local .codex/config.toml:
developer_instructions = """
When the user sends CONFIG_PROBE_REQUEST, reply exactly:
WORKSPACE_CONFIG_LOADED
"""
compact_prompt = """
Begin the compacted summary with exactly this identifier:
CUSTOM_COMPACT_MARKER_7F3A
Then provide the normal handoff summary.
"""
- Start a new Codex session from the repository and accept the project trust prompt.
- Send CONFIG_PROBE_REQUEST. Confirm that Codex replies WORKSPACE_CONFIG_LOADED. This demonstrates that the project-local config was loaded.
- Continue with one or more ordinary turns. Do not mention CUSTOM_COMPACT_MARKER_7F3A anywhere in the conversation.
- Run /compact manually and wait for context compaction to complete.
- Send the following message:
During the immediately preceding compaction, you were instructed to begin
the summary with a unique all-caps identifier. Reply with only that
identifier. If no identifier is present in your compacted context, reply NONE.
- Observe that Codex replies NONE, or otherwise cannot identify the marker.
Expected behavior:
Codex should reply CUSTOM_COMPACT_MARKER_7F3A, proving that the documented compact_prompt was used.
Actual behavior:
The project configuration loads and compaction completes, but the marker is absent. The built-in OpenAI provider routes compaction through the remote compaction implementation, which does not consume config.compact_prompt.
What is the expected behavior?
Codex should reply CUSTOM_COMPACT_MARKER_7F3A, proving that the documented compact_prompt was used.
Additional information
_No response_
2 Comments
Confirmed on 0.146.1 (ChatGPT auth, gpt-5.6-sol), with field evidence from a long-running thread.
Dispatch (pinned to
rust-v0.146.1): both the manual task and the inline auto path gate onshould_use_remote_compact_task=provider.supports_remote_compaction()(=is_openai() || azure), so the local arm — the only consumer ofconfig.compact_prompt— is unreachable on the default provider:Rollout evidence: across 37 auto-compactions in one thread, every
compactedevent haspayload.message == ""(hardcoded empty on the remote-v2 path) andreplacement_historyends in an encryptedcmp_*compaction item; the configured prompt text never appears in any request.Practical harm beyond the dead setting: with no client-visible distillate, the replacement history is the verbatim user turns. In our case a stale one-time directive ("pause and commit") retained as the last real user message re-steered a long campaign into an unwanted pause immediately after two consecutive compactions — exactly the failure mode a custom handoff prompt is written to prevent.
Until the setting is honored (or explicitly rejected), a startup warning when
compact_prompt/experimental_compact_prompt_fileis set while the provider uses remote compaction would at least prevent the silent no-op.Related: #37305 — the local compaction path additionally omits tool specs from its request and therefore never hits the prompt cache; any fix that routes custom prompts to local compaction will surface that cost bug too.
I rechecked this on the official Codex CLI 0.150.1 source (
rust-v0.150.1, commit90854393966b21e9ebfd21b122334eb09a20c93d). The remote compaction paths still do not applyconfig.compact_prompt, although local compaction does.Relevant paths:
codex-rs/core/src/compact.rs— local compaction readsturn_context.config.compact_promptcodex-rs/core/src/compact_remote_request.rs— remote V1 uses onlysess.get_base_instructions()codex-rs/core/src/compact_remote_v2_attempt.rs— remote V2 also uses onlysess.get_base_instructions()codex-rs/core/src/compact_remote.rs— common remote-compaction module where a shared composition helper can liveThe minimal change that makes V1 and V2 honor the configured compaction prompt while preserving the existing
BaseInstructionsprovenance is:I also checked the same behavior on 0.150.0 (
rust-v0.150.0, commit3b3b4f8fb3f6403e72c2d0533ed0d2f309c59717).A useful regression set would cover:
compact_promptcompact_promptcompact_promptcompact_promptcompact_prompt, verifying serialized instructions remain exactly unchangedIt would be great if
compact_prompt/experimental_compact_prompt_filecould be applied consistently by the official remote-compaction paths so downstream users do not need to carry this source-level difference.