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 authored and copyberry committed 2026-07-22 19:31:54 +00:00
1 parent 06782eded7
commit 08ae0fc0ce
25 files changed
+237 -399

No files matched your search

@@ -2663,7 +2663,9 @@ mod tests {
thread_id: conversation_id,
thread: conversation,
..
} = thread_manager.start_thread(config.clone()).await?;
} = thread_manager
.start_thread(codex_core::StartThreadOptions::new(config.clone()))
.await?;
let thread_state = new_thread_state();
let thread_watch_manager = ThreadWatchManager::new();
let (tx, mut rx) = mpsc::channel(CHANNEL_CAPACITY);
@@ -3241,7 +3243,9 @@ mod tests {
thread_id: conversation_id,
thread: conversation,
..
} = thread_manager.start_thread(config.clone()).await?;
} = thread_manager
.start_thread(codex_core::StartThreadOptions::new(config.clone()))
.await?;
let thread_state = new_thread_state();
{
let mut state = thread_state.lock().await;
@@ -3329,7 +3333,9 @@ mod tests {
thread_id: conversation_id,
thread: conversation,
..
} = thread_manager.start_thread(config).await?;
} = thread_manager
.start_thread(codex_core::StartThreadOptions::new(config))
.await?;
let child_thread_id = ThreadId::new();
let child_thread_id_string = child_thread_id.to_string();
let thread_watch_manager = ThreadWatchManager::new();
@@ -3419,7 +3425,9 @@ mod tests {
thread_id: conversation_id,
thread: conversation,
..
} = thread_manager.start_thread(config).await?;
} = thread_manager
.start_thread(codex_core::StartThreadOptions::new(config))
.await?;
let (tx, mut rx) = mpsc::channel(CHANNEL_CAPACITY);
let outgoing = Arc::new(OutgoingMessageSender::new(
tx,