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:
parent
f09170b574
commit
ed06f90fb3
1 changed files with 6 additions and 3 deletions
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue