[codex-core] Address compaction review feedback [ci changed_files]

Remove the redundant inline compaction request trace and clarify that streamed server-side compaction rebuilds replacement history on response.completed from the checkpoint snapshot.

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
Cooper Gamble
2026-03-09 17:58:56 +00:00
parent 46615cc195
commit c4b2ba0ba3
2 changed files with 5 additions and 7 deletions

View File

@@ -578,13 +578,6 @@ impl ModelClientSession {
.inline_compaction_threshold
.map(ApiContextManagement::compaction)
.map(|entry| vec![entry]);
if let Some(threshold) = prompt.inline_compaction_threshold {
trace!(
model = %model_info.slug,
compact_threshold = threshold,
"attaching inline server-side compaction to responses request"
);
}
let request = ResponsesApiRequest {
model: model_info.slug.clone(),
instructions: instructions.clone(),

View File

@@ -152,6 +152,9 @@ pub(crate) struct OutputItemResult {
}
pub(crate) struct PendingServerSideCompactionCheckpoint {
// Snapshot the raw history at the moment the compaction item streamed. We cannot build
// replacement history yet because later same-turn output may still arrive before
// `response.completed`.
pub history_at_checkpoint: Vec<ResponseItem>,
pub item: ResponseItem,
pub turn_item: TurnItem,
@@ -191,6 +194,8 @@ pub(crate) async fn handle_output_item_done(
EventMsg::RawResponseItem(RawResponseItemEvent { item: item.clone() }),
)
.await;
// Replacement history is derived on `response.completed` from this snapshot plus whatever
// else the model streamed afterward.
output.pending_server_side_compaction = Some(PendingServerSideCompactionCheckpoint {
history_at_checkpoint: ctx.sess.clone_history().await.raw_items().to_vec(),
item,