Race condition in compact (#2746)

This fixes the flakiness in
`summarize_context_three_requests_and_instructions` because we should
trim history before sending task complete.
This commit is contained in:
Ahmed Ibrahim
2025-08-28 12:53:00 -07:00
committed by GitHub
parent f09170b574
commit ed06f90fb3

View File

@@ -1884,6 +1884,12 @@ async fn run_compact_task(
}
sess.remove_task(&sub_id);
{
let mut state = sess.state.lock_unchecked();
state.history.keep_last_messages(1);
}
let event = Event {
id: sub_id.clone(),
msg: EventMsg::AgentMessage(AgentMessageEvent {
@@ -1898,9 +1904,6 @@ async fn run_compact_task(
}),
};
sess.send_event(event).await;
let mut state = sess.state.lock_unchecked();
state.history.keep_last_messages(1);
}
async fn handle_response_item(