Consolidate thread startup around StartThreadOptions (#34814)

## What changed

- Add `StartThreadOptions::new` to provide the standard configuration for a new thread.
- Make `ThreadManager::start_thread` the single thread-start entry point and migrate callers from the previous convenience methods.
- Derive default environment selections when `environments` is `None`, while preserving explicit selections, including an empty list.

GitOrigin-RevId: 8977dc11aed54c5e1215a81eaed2b2cf5fc6087a
This commit is contained in:
pakrym-oai
2026-07-22 19:31:54 +00:00
committed by copyberry
parent 06782eded7
commit 08ae0fc0ce
25 changed files with 237 additions and 399 deletions
+5 -1
View File
@@ -11,6 +11,7 @@ use crate::outgoing_message::OutgoingNotificationMeta;
use crate::patch_approval::handle_patch_approval_request;
use codex_core::CodexThread;
use codex_core::NewThread;
use codex_core::StartThreadOptions;
use codex_core::ThreadManager;
use codex_core::config::Config as CodexConfig;
use codex_protocol::ThreadId;
@@ -66,7 +67,10 @@ pub async fn run_codex_tool_session(
thread_id,
thread,
session_configured,
} = match thread_manager.start_thread(config.clone()).await {
} = match thread_manager
.start_thread(StartThreadOptions::new(config.clone()))
.await
{
Ok(res) => res,
Err(e) => {
let result = CallToolResult::error(vec![Content::text(format!(