Box the session startup future at its API boundary (#41853)

## What changed

- Make `Session::spawn` return a `BoxFuture` while preserving lazy session
  initialization.
- Prevent the startup wrapper from being inlined so callers do not expose its
  concrete future.
- Await the returned future directly at session creation call sites.

GitOrigin-RevId: 5432745aae1c934b16202716a8d49a8553de2018
This commit is contained in:
Benjamin Carlsson
2026-08-31 14:43:39 +00:00
committed by copyberry
parent 305eed102d
commit 9d19c7426e
3 changed files with 29 additions and 23 deletions
+2 -2
View File
@@ -111,7 +111,7 @@ pub(crate) async fn run_codex_thread_interactive(
} else {
Arc::clone(&parent_session.services.extensions)
};
let (session, io) = Box::pin(Session::spawn(SessionSpawnArgs {
let (session, io) = Session::spawn(SessionSpawnArgs {
config,
allow_provider_model_fallback: false,
user_instructions,
@@ -158,7 +158,7 @@ pub(crate) async fn run_codex_thread_interactive(
inherited_multi_agent_version: Some(MultiAgentVersion::Disabled),
git_enrichment_policy,
windows_sandbox_proxy_settings_mode,
}))
})
.or_cancel(&cancel_token)
.await??;
let thread_config = session.thread_config_snapshot().await;