mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
[codex] Use standalone tools for Responses Lite (#26490)
## Summary Responses Lite does not execute hosted Responses tools, so models using it must route web search and image generation through Codex-owned executors & standalone Response's API endpoints. This PR is stacked on #26487. ## Validation - `cargo test -p codex-core responses_lite_ --lib` - `cargo test -p codex-core standalone_executors_remain_hidden_without_flags_or_responses_lite --lib` - `cargo test -p codex-core hosted_tools_follow_provider_auth_model_and_config_gates --lib` - `cargo test -p codex-web-search-extension -p codex-image-generation-extension` - `cargo test -p codex-app-server --test all standalone_` - `cargo fmt --all -- --check`
This commit is contained in:
@@ -23,12 +23,14 @@ use codex_core::thread_store_from_config;
|
||||
use codex_exec_server::CreateDirectoryOptions;
|
||||
use codex_exec_server::ExecutorFileSystem;
|
||||
use codex_exec_server::RemoveOptions;
|
||||
use codex_extension_api::ExtensionRegistry;
|
||||
use codex_extension_api::empty_extension_registry;
|
||||
use codex_login::CodexAuth;
|
||||
use codex_model_provider_info::ModelProviderInfo;
|
||||
use codex_model_provider_info::built_in_model_providers;
|
||||
use codex_models_manager::bundled_models_response;
|
||||
use codex_protocol::models::PermissionProfile;
|
||||
use codex_protocol::openai_models::ModelInfo;
|
||||
use codex_protocol::openai_models::ModelsResponse;
|
||||
use codex_protocol::protocol::AskForApproval;
|
||||
use codex_protocol::protocol::EventMsg;
|
||||
@@ -216,6 +218,7 @@ pub struct TestCodexBuilder {
|
||||
cloud_config_bundle: Option<CloudConfigBundleLoader>,
|
||||
user_shell_override: Option<Shell>,
|
||||
exec_server_url: Option<String>,
|
||||
extensions: Arc<ExtensionRegistry<Config>>,
|
||||
}
|
||||
|
||||
impl TestCodexBuilder {
|
||||
@@ -239,6 +242,26 @@ impl TestCodexBuilder {
|
||||
})
|
||||
}
|
||||
|
||||
pub fn with_model_info_override<T>(self, model: &str, override_model_info: T) -> Self
|
||||
where
|
||||
T: FnOnce(&mut ModelInfo) + Send + 'static,
|
||||
{
|
||||
let model = model.to_string();
|
||||
self.with_config(move |config| {
|
||||
let model_catalog = config.model_catalog.get_or_insert_with(|| {
|
||||
bundled_models_response()
|
||||
.unwrap_or_else(|err| panic!("bundled models.json should parse: {err}"))
|
||||
});
|
||||
let model_info = model_catalog
|
||||
.models
|
||||
.iter_mut()
|
||||
.find(|model_info| model_info.slug == model)
|
||||
.unwrap_or_else(|| panic!("{model} should exist in the configured model catalog"));
|
||||
override_model_info(model_info);
|
||||
config.model = Some(model);
|
||||
})
|
||||
}
|
||||
|
||||
pub fn with_pre_build_hook<F>(mut self, hook: F) -> Self
|
||||
where
|
||||
F: FnOnce(&Path) + Send + 'static,
|
||||
@@ -280,6 +303,11 @@ impl TestCodexBuilder {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_extensions(mut self, extensions: Arc<ExtensionRegistry<Config>>) -> Self {
|
||||
self.extensions = extensions;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_windows_cmd_shell(self) -> Self {
|
||||
if cfg!(windows) {
|
||||
self.with_user_shell(get_shell_by_model_provided_path(&PathBuf::from("cmd.exe")))
|
||||
@@ -473,7 +501,7 @@ impl TestCodexBuilder {
|
||||
codex_core::test_support::auth_manager_from_auth(auth.clone()),
|
||||
SessionSource::Exec,
|
||||
Arc::clone(&environment_manager),
|
||||
empty_extension_registry(),
|
||||
Arc::clone(&self.extensions),
|
||||
/*analytics_events_client*/ None,
|
||||
thread_store,
|
||||
state_db.clone(),
|
||||
@@ -1041,6 +1069,7 @@ pub fn test_codex() -> TestCodexBuilder {
|
||||
cloud_config_bundle: None,
|
||||
user_shell_override: None,
|
||||
exec_server_url: None,
|
||||
extensions: empty_extension_registry(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user