mirror of
https://github.com/openai/codex.git
synced 2026-04-24 06:35:50 +00:00
[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:
@@ -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(),
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user