From 00315bb12a7b3b2a5429e27a811739c3fa53bd6c Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Mon, 23 Nov 2026 12:34:54 +0000 Subject: [PATCH] Box the session startup cleanup future (#63333) ## What changed Return a `BoxFuture<'_, ()>` from `SessionStartup::cleanup` and move the teardown logic into the private async `cleanup_inner` method. Callers continue to await `cleanup()` at the same points. GitOrigin-RevId: 5c263027fb93d64f1872f4f3d5b732df4b4427e5 --- codex-rs/core/src/session/startup.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/codex-rs/core/src/session/startup.rs b/codex-rs/core/src/session/startup.rs index 9f6e5cecdc..bdb3c848a9 100644 --- a/codex-rs/core/src/session/startup.rs +++ b/codex-rs/core/src/session/startup.rs @@ -62,7 +62,11 @@ impl SessionStartup { } } - pub(crate) async fn cleanup(&self) { + pub(crate) fn cleanup(&self) -> BoxFuture<'_, ()> { + Box::pin(self.cleanup_inner()) + } + + async fn cleanup_inner(&self) { let mut teardown = self.lock_teardown().take(); if let Some(teardown) = teardown.as_mut() && let Some(session) = self.session.get()