Wait for stale startup prewarm abort before MCP swap

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
starr-openai
2026-05-08 21:08:37 -07:00
parent b8f21d129c
commit 9ed7969add
2 changed files with 3 additions and 2 deletions

View File

@@ -350,7 +350,7 @@ impl Session {
// The prewarm was built with the stale manager and can hold a read
// lock while resolving tools. Abort it before swapping managers so
// an MCP refresh cannot block turn startup behind stale work.
startup_prewarm.abort();
startup_prewarm.abort_and_wait().await;
}
let mut old_manager = {

View File

@@ -47,8 +47,9 @@ impl SessionStartupPrewarmHandle {
}
}
pub(crate) fn abort(self) {
pub(crate) async fn abort_and_wait(self) {
self.task.abort();
let _ = self.task.await;
}
async fn resolve(