mirror of
https://github.com/openai/codex.git
synced 2026-11-03 08:22:30 +00:00
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:
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,
|
||||
|
||||
@@ -198,7 +198,10 @@ mod tests {
|
||||
Some(temp_dir.path().join("good")),
|
||||
)
|
||||
.await?;
|
||||
let thread = thread_manager.start_thread(thread_config).await?.thread;
|
||||
let thread = thread_manager
|
||||
.start_thread(codex_core::StartThreadOptions::new(thread_config))
|
||||
.await?
|
||||
.thread;
|
||||
std::fs::write(
|
||||
temp_dir.path().join(codex_config::CONFIG_TOML_FILE),
|
||||
r#"
|
||||
@@ -337,8 +340,12 @@ enabled = false
|
||||
/*external_time_provider*/ None,
|
||||
)
|
||||
});
|
||||
thread_manager.start_thread(good_config).await?;
|
||||
thread_manager.start_thread(bad_config).await?;
|
||||
thread_manager
|
||||
.start_thread(codex_core::StartThreadOptions::new(good_config))
|
||||
.await?;
|
||||
thread_manager
|
||||
.start_thread(codex_core::StartThreadOptions::new(bad_config))
|
||||
.await?;
|
||||
|
||||
let loader = Arc::new(CountingThreadConfigLoader {
|
||||
good_cwd: AbsolutePathBuf::try_from(good_cwd)?,
|
||||
|
||||
@@ -1228,8 +1228,7 @@ impl ThreadRequestProcessor {
|
||||
..
|
||||
} = listener_task_context
|
||||
.thread_manager
|
||||
.start_thread_with_options(StartThreadOptions {
|
||||
config,
|
||||
.start_thread(StartThreadOptions {
|
||||
allow_provider_model_fallback,
|
||||
initial_history: match session_start_source
|
||||
.unwrap_or(codex_app_server_protocol::ThreadStartSource::Startup)
|
||||
@@ -1238,14 +1237,14 @@ impl ThreadRequestProcessor {
|
||||
codex_app_server_protocol::ThreadStartSource::Clear => InitialHistory::Cleared,
|
||||
},
|
||||
history_mode,
|
||||
session_source: None,
|
||||
thread_source,
|
||||
dynamic_tools,
|
||||
metrics_service_name: service_name,
|
||||
parent_trace: request_trace,
|
||||
environments,
|
||||
environments: Some(environments),
|
||||
thread_extension_init,
|
||||
supports_openai_form_elicitation,
|
||||
..StartThreadOptions::new(config)
|
||||
})
|
||||
.instrument(tracing::info_span!(
|
||||
"app_server.thread_start.create_thread",
|
||||
|
||||
Reference in new issue
Block a user