[codex] Add internal auto-compaction opt-out#28260
Open
rhan-oai wants to merge 3 commits into
Open
Conversation
06a856b to
9ddb7a0
Compare
9ddb7a0 to
df364c3
Compare
jif-oai
approved these changes
Jun 16, 2026
jif-oai
left a comment
Collaborator
There was a problem hiding this comment.
Pre-approving but my comment is blocking and needs to be fixed
| @@ -299,7 +299,10 @@ pub(crate) async fn run_turn( | |||
| } | |||
|
|
|||
| // as long as compaction works well in getting us way below the token limit, we shouldn't worry about being in an infinite loop. | |||
| if token_limit_reached && needs_follow_up { | |||
| if turn_context.features.enabled(Feature::AutoCompaction) | |||
Collaborator
There was a problem hiding this comment.
This still lets new_context drop the whole transcript when token_budget is enabled: that tool is exposed independently, and maybe_start_new_context_window runs above this gate.
Should disabling auto_compaction also hide/reject new_context? Otherwise the SPO escape hatch can discard context instead of reaching the provider error
| @@ -4504,6 +4581,44 @@ async fn snapshot_request_shape_pre_turn_compaction_context_window_exceeded() { | |||
| ); | |||
| } | |||
|
|
|||
| #[tokio::test(flavor = "multi_thread", worker_threads = 2)] | |||
| async fn auto_compaction_feature_disabled_skips_pre_turn_compaction() { | |||
Collaborator
There was a problem hiding this comment.
Can we add a disabled model-switch/comp-hash case too?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
auto_compactionfeature flag as an internal escape hatch/compactbehavior and surface the existing context-window error when the provider runs out of roomMotivation
Long-running SPO optimization rollouts need the option to preserve their full context and fail on context exhaustion instead of entering another compaction window. This deliberately uses the existing feature-flag mechanism rather than adding a dedicated public config or app-server API.
Disable it with:
Testing
just test -p codex-features— 51 passedjust test -p codex-core auto_compaction_feature_disabled— 2 passedjust fix -p codex-core -p codex-featuresjust write-config-schemajust test -p codex-core— the new compaction tests passed; the overall local run had 54 unrelated environment failures, primarily missing first-party test binaries and shell-snapshot timeouts