fix: races in end of turn (#16566)

This commit is contained in:
jif-oai authored and GitHub committed 2026-04-02 15:55:55 +02:00
1 parent bd50496411
commit e47ed5e57f
5 files changed
+72 -6

No files matched your search

+4
View File
@@ -213,6 +213,10 @@ pub(crate) async fn handle_output_item_done(
match ToolRouter::build_tool_call(ctx.sess.as_ref(), item.clone()).await {
// The model emitted a tool call; log it, persist the item immediately, and queue the tool execution.
Ok(Some(call)) => {
ctx.sess
.accept_mailbox_delivery_for_current_turn(&ctx.turn_context.sub_id)
.await;
let payload_preview = call.payload.log_payload().into_owned();
tracing::info!(
thread_id = %ctx.sess.conversation_id,