mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
chore: fix merge race (auto-compaction feature access) (#29393)
## Summary - read the `AutoCompaction` feature flag through `TurnContext::config` - fix both the mid-turn and pre-sampling compaction checks ## Why #28260 was validated against an older base where `TurnContext` exposed a direct `features` field. It was then merged after that field had moved under `config`, leaving the merge result unable to compile with `E0609` on `turn_context.features`. This restores compilation for Bazel, SDK, and argument-comment-lint jobs that build `codex-core`. Behavior is unchanged: disabling `auto_compaction` still skips automatic compaction. ## Validation - `just fmt` - `CODEX_HOME=/private/tmp/codex-fix-auto-compaction-test-home just test -p codex-core auto_compaction_feature_disabled` — 4 passed - `just test -p codex-core` — `codex-core` compiled; 2,722 passed and 89 unrelated local-environment failures remained because the sandbox could not write the default Codex SQLite/proxy paths and some first-party test binaries were unavailable
This commit is contained in:
committed by
GitHub
Unverified
parent
566f7bf631
commit
98845e4840
@@ -334,7 +334,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 turn_context.features.enabled(Feature::AutoCompaction)
|
||||
if turn_context
|
||||
.config
|
||||
.features
|
||||
.enabled(Feature::AutoCompaction)
|
||||
&& token_limit_reached
|
||||
&& needs_follow_up
|
||||
{
|
||||
@@ -848,7 +851,11 @@ async fn run_pre_sampling_compact(
|
||||
turn_context: &Arc<TurnContext>,
|
||||
client_session: &mut ModelClientSession,
|
||||
) -> CodexResult<()> {
|
||||
if !turn_context.features.enabled(Feature::AutoCompaction) {
|
||||
if !turn_context
|
||||
.config
|
||||
.features
|
||||
.enabled(Feature::AutoCompaction)
|
||||
{
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user