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 authored and copyberry committed 2026-08-31 14:43:39 +00:00
1 parent 305eed102d
commit 9d19c7426e
3 files changed
+29 -23

No files matched your search

+2 -2
View File
@@ -1987,7 +1987,7 @@ impl ThreadManagerState {
} else {
codex_sandboxing::WindowsSandboxProxySettingsMode::Reconcile
};
let (session, io) = Box::pin(Session::spawn(SessionSpawnArgs {
let (session, io) = Session::spawn(SessionSpawnArgs {
config,
allow_provider_model_fallback,
user_instructions,
@@ -2027,7 +2027,7 @@ impl ThreadManagerState {
inherited_multi_agent_version: multi_agent_version,
git_enrichment_policy: GitEnrichmentPolicy::Fresh,
windows_sandbox_proxy_settings_mode,
}))
})
.await?;
// Enable Full Access form input only after session startup so a required MCP server cannot
// block startup while waiting for form input.