[codex] Remove auto-compaction opt-out (#29815)

## Summary

- remove the default-on `auto_compaction` feature flag and generated
config schema entries
- restore unconditional pre-turn, model-switch/hash, and mid-turn
automatic compaction
- expose `new_context` whenever token-budget tooling is enabled
- remove the disabled-auto-compaction integration coverage introduced by
#28260

## Motivation

Roll back the internal auto-compaction escape hatch added in #28260.
Automatic compaction should no longer be suppressible with `--disable
auto_compaction`; existing manual `/compact` behavior remains unchanged.

## Testing

- `just write-config-schema`
- `just test -p codex-features` — 53 passed
- `just test -p codex-core 'suite::compact::'` — 36 passed
- `just test -p codex-core
suite::token_budget::new_context_tool_starts_new_window_before_follow_up`
— 1 passed
- `just fix -p codex-core -p codex-features`
- `just fmt`
- `just test -p codex-core` — 2,778 passed, 59 failed, 16 skipped;
failures were outside the changed compaction paths and were dominated by
missing first-party test binaries and shell-snapshot timeouts
This commit is contained in:
rhan-oai
2026-06-24 00:15:04 -07:00
committed by GitHub
Unverified
parent 31e428a1ef
commit 2a320fedb5
6 changed files with 2 additions and 287 deletions
+1 -14
View File
@@ -332,13 +332,8 @@ pub(crate) async fn run_turn(
.await;
// as long as compaction works well in getting us way below the token limit, we shouldn't worry about being in an infinite loop.
let auto_compact_needed = turn_context
.config
.features
.enabled(Feature::AutoCompaction)
&& token_limit_reached;
if needs_follow_up
&& (sess.take_new_context_window_request().await || auto_compact_needed)
&& (sess.take_new_context_window_request().await || token_limit_reached)
{
if let Err(err) = run_auto_compact(
&sess,
@@ -792,14 +787,6 @@ async fn run_pre_sampling_compact(
turn_context: &Arc<TurnContext>,
client_session: &mut ModelClientSession,
) -> CodexResult<()> {
if !turn_context
.config
.features
.enabled(Feature::AutoCompaction)
{
return Ok(());
}
maybe_run_previous_model_inline_compact(sess, turn_context, client_session).await?;
let token_status =
super::context_window::context_window_token_status(sess.as_ref(), turn_context.as_ref())