Files
codex/codex-rs/analytics
Henry Levy 49e248d4c3 Add opt-in compaction after final responses (#46541)
## What changed

Add `model_post_turn_compact_threshold_percent` to trigger compaction after a final response when context usage reaches the configured percentage of the usable window or an existing auto-compaction limit. Accept values from `0` to `100`; omitted or zero disables the feature.

Skip post-turn compaction when input is pending, the turn is cancelled, or token-budget mode is enabled. Disable it for approval reviewers to avoid delaying approval completion, and record a distinct `PostTurn` analytics phase.

Buffer local post-turn summaries until compaction succeeds and require a nonempty assistant summary before replacing history. Log compaction failures without failing the completed turn, while still propagating interruptions and turn aborts.

GitOrigin-RevId: b616994175829bd83b5d7974f95dabb042a39a89
2026-09-19 00:52:56 +00:00
..