mirror of
https://github.com/openai/codex.git
synced 2026-11-12 21:20:34 +00:00
Fix sticky environment lint failures
Group thread-start options for clippy and make the new environment tests comply with stricter CI lint settings. Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
@@ -118,6 +118,7 @@ pub(crate) mod web_search;
|
||||
pub(crate) mod windows_sandbox_read_grants;
|
||||
pub use thread_manager::ForkSnapshot;
|
||||
pub use thread_manager::NewThread;
|
||||
pub use thread_manager::StartThreadWithToolsOptions;
|
||||
pub use thread_manager::ThreadManager;
|
||||
pub use thread_manager::build_models_manager;
|
||||
pub use web_search::web_search_action_detail;
|
||||
|
||||
@@ -4137,7 +4137,12 @@ async fn multi_environment_feature_without_selections_uses_single_environment_be
|
||||
let (_session, turn_context, _rx) = make_session_and_context_with_auth_and_config_and_rx(
|
||||
CodexAuth::from_api_key("Test API Key"),
|
||||
Vec::new(),
|
||||
|config| config.features.enable(Feature::MultiEnvironmentTools),
|
||||
|config| {
|
||||
config
|
||||
.features
|
||||
.enable(Feature::MultiEnvironmentTools)
|
||||
.expect("multi-environment tools feature should enable");
|
||||
},
|
||||
)
|
||||
.await;
|
||||
|
||||
@@ -4162,7 +4167,12 @@ async fn multi_environment_tools_enable_only_with_feature_and_selection() {
|
||||
let (session, _turn_context, _rx) = make_session_and_context_with_auth_and_config_and_rx(
|
||||
CodexAuth::from_api_key("Test API Key"),
|
||||
Vec::new(),
|
||||
|config| config.features.enable(Feature::MultiEnvironmentTools),
|
||||
|config| {
|
||||
config
|
||||
.features
|
||||
.enable(Feature::MultiEnvironmentTools)
|
||||
.expect("multi-environment tools feature should enable");
|
||||
},
|
||||
)
|
||||
.await;
|
||||
let selected_cwd =
|
||||
|
||||
@@ -198,6 +198,16 @@ pub struct ThreadManager {
|
||||
_test_codex_home_guard: Option<TempCodexHomeGuard>,
|
||||
}
|
||||
|
||||
pub struct StartThreadWithToolsOptions {
|
||||
pub config: Config,
|
||||
pub initial_history: InitialHistory,
|
||||
pub dynamic_tools: Vec<codex_protocol::dynamic_tools::DynamicToolSpec>,
|
||||
pub persist_extended_history: bool,
|
||||
pub metrics_service_name: Option<String>,
|
||||
pub parent_trace: Option<W3cTraceContext>,
|
||||
pub environment_selections: Option<Vec<codex_protocol::protocol::TurnEnvironmentSelection>>,
|
||||
}
|
||||
|
||||
/// Shared, `Arc`-owned state for [`ThreadManager`]. This `Arc` is required to have a single
|
||||
/// `Arc` reference that can be downgraded to by `AgentControl` while preventing every single
|
||||
/// function to require an `Arc<&Self>`.
|
||||
@@ -496,38 +506,34 @@ impl ThreadManager {
|
||||
dynamic_tools: Vec<codex_protocol::dynamic_tools::DynamicToolSpec>,
|
||||
persist_extended_history: bool,
|
||||
) -> CodexResult<NewThread> {
|
||||
Box::pin(self.start_thread_with_tools_and_service_name(
|
||||
config,
|
||||
InitialHistory::New,
|
||||
dynamic_tools,
|
||||
persist_extended_history,
|
||||
/*metrics_service_name*/ None,
|
||||
/*parent_trace*/ None,
|
||||
/*environment_selections*/ None,
|
||||
))
|
||||
Box::pin(
|
||||
self.start_thread_with_tools_and_service_name(StartThreadWithToolsOptions {
|
||||
config,
|
||||
initial_history: InitialHistory::New,
|
||||
dynamic_tools,
|
||||
persist_extended_history,
|
||||
metrics_service_name: None,
|
||||
parent_trace: None,
|
||||
environment_selections: None,
|
||||
}),
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn start_thread_with_tools_and_service_name(
|
||||
&self,
|
||||
config: Config,
|
||||
initial_history: InitialHistory,
|
||||
dynamic_tools: Vec<codex_protocol::dynamic_tools::DynamicToolSpec>,
|
||||
persist_extended_history: bool,
|
||||
metrics_service_name: Option<String>,
|
||||
parent_trace: Option<W3cTraceContext>,
|
||||
environment_selections: Option<Vec<codex_protocol::protocol::TurnEnvironmentSelection>>,
|
||||
options: StartThreadWithToolsOptions,
|
||||
) -> CodexResult<NewThread> {
|
||||
Box::pin(self.state.spawn_thread(
|
||||
config,
|
||||
initial_history,
|
||||
options.config,
|
||||
options.initial_history,
|
||||
Arc::clone(&self.state.auth_manager),
|
||||
self.agent_control(),
|
||||
dynamic_tools,
|
||||
persist_extended_history,
|
||||
metrics_service_name,
|
||||
parent_trace,
|
||||
environment_selections,
|
||||
options.dynamic_tools,
|
||||
options.persist_extended_history,
|
||||
options.metrics_service_name,
|
||||
options.parent_trace,
|
||||
options.environment_selections,
|
||||
/*user_shell_override*/ None,
|
||||
))
|
||||
.await
|
||||
|
||||
Reference in New Issue
Block a user