Skip to content

Commit 013b23f

Browse files
committed
comment
1 parent c823ebb commit 013b23f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

codex-rs/core/src/codex.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4398,16 +4398,17 @@ async fn run_pre_sampling_compact(
43984398
{
43994399
Ok(previous_turn_context) => previous_turn_context,
44004400
Err(err) => {
4401+
// If pre-turn model-switch compaction fails, we just emit <model_switch>
4402+
// because on the next turn previous_model will equal current_model.
4403+
// This is a bit sad, might be better to revert the user to the previous model
4404+
// (with a warning) and avoid emitting <model_switch> at all.
44014405
if let Some(model_switch_item) = sess.build_model_instructions_update_item(
44024406
None,
44034407
previous_model.as_deref(),
44044408
turn_context.as_ref(),
44054409
) {
44064410
sess.record_conversation_items(turn_context.as_ref(), &[model_switch_item])
44074411
.await;
4408-
// TODO(charley): This is a big sad fallback. If pre-turn model-switch compaction
4409-
// fails, a better behavior may be to revert the user to the previous model and
4410-
// avoid emitting <model_switch> at all.
44114412
}
44124413
return Err(err);
44134414
}

0 commit comments

Comments
 (0)