Skip to content

Commit 06a0b36

Browse files
authored
ref: state 9 (#4171)
1 parent f4ceeba commit 06a0b36

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

codex-rs/core/src/codex.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,11 @@ impl Session {
715715
state.record_items(items.iter());
716716
}
717717

718+
async fn replace_history(&self, items: Vec<ResponseItem>) {
719+
let mut state = self.state.lock().await;
720+
state.replace_history(items);
721+
}
722+
718723
async fn persist_rollout_response_items(&self, items: &[ResponseItem]) {
719724
let rollout_items: Vec<RolloutItem> = items
720725
.iter()

codex-rs/core/src/codex/compact.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,7 @@ async fn run_compact_task_inner(
156156
let user_messages = collect_user_messages(&history_snapshot);
157157
let initial_context = sess.build_initial_context(turn_context.as_ref());
158158
let new_history = build_compacted_history(initial_context, &user_messages, &summary_text);
159-
{
160-
let mut state = sess.state.lock().await;
161-
state.replace_history(new_history);
162-
}
159+
sess.replace_history(new_history).await;
163160

164161
let rollout_item = RolloutItem::Compacted(CompactedItem {
165162
message: summary_text.clone(),

0 commit comments

Comments
 (0)