WIP fase 2b-2: rimosso login ChatGPT/OAuth/device code, agent/workload identity, backend-client; resta solo chiave API (test non tutti verdi)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
andrea.difonzo
2026-11-10 06:00:44 +01:00
parent 82347a58ed
commit 231e8cd136
661 changed files with 4924 additions and 64817 deletions

View File

@@ -116,7 +116,7 @@ async fn child_loads_remote_tool_search_with_thread_provider_headers(
.await;
let mut test = test_codex()
.with_model(REMOTE_MODEL_SLUG)
.with_auth(CodexAuth::create_dummy_chatgpt_auth_for_testing())
.with_catalog_discovery_api_key()
.with_model_catalog_settings(catalog_settings)
.with_config(|config| {
config
@@ -209,7 +209,7 @@ async fn child_preserves_parent_catalog_after_cache_write_failure() -> Result<()
.await;
let mut test = test_codex()
.with_model(REMOTE_MODEL_SLUG)
.with_auth(CodexAuth::create_dummy_chatgpt_auth_for_testing())
.with_catalog_discovery_api_key()
.with_model_catalog_settings(ModelCatalogSettings::with_cache(cache.clone()))
.with_config(|config| {
config
@@ -425,7 +425,7 @@ async fn remote_models_get_model_info_uses_longest_matching_prefix() -> Result<(
let codex_home = TempDir::new()?;
let config = load_default_config_for_test(&codex_home).await;
let auth = CodexAuth::create_dummy_chatgpt_auth_for_testing();
let auth = CodexAuth::from_api_key("Test API Key");
let provider = ModelProviderInfo {
base_url: Some(format!("{}/v1", server.uri())),
..built_in_model_providers(/* openai_base_url */ /*openai_base_url*/ None)["openai"].clone()
@@ -485,7 +485,7 @@ async fn remote_models_config_context_window_override_clamps_to_max_context_wind
.await;
let TestCodex { codex, .. } = test_codex()
.with_auth(CodexAuth::create_dummy_chatgpt_auth_for_testing())
.with_catalog_discovery_api_key()
.with_config(|config| {
config.model = Some(requested_model.to_string());
config.model_context_window = Some(1_000_000);
@@ -546,7 +546,7 @@ async fn remote_models_config_override_above_max_uses_max_context_window() -> Re
.await;
let TestCodex { codex, .. } = test_codex()
.with_auth(CodexAuth::create_dummy_chatgpt_auth_for_testing())
.with_catalog_discovery_api_key()
.with_config(|config| {
config.model = Some(requested_model.to_string());
config.model_context_window = Some(500_000);
@@ -607,7 +607,7 @@ async fn remote_models_use_context_window_when_config_override_is_absent() -> Re
.await;
let TestCodex { codex, .. } = test_codex()
.with_auth(CodexAuth::create_dummy_chatgpt_auth_for_testing())
.with_catalog_discovery_api_key()
.with_config(|config| {
config.model = Some(requested_model.to_string());
})
@@ -694,7 +694,7 @@ async fn remote_models_long_model_slug_is_sent_with_supported_reasoning(
.await;
let TestCodex { codex, .. } = test_codex()
.with_auth(CodexAuth::create_dummy_chatgpt_auth_for_testing())
.with_catalog_discovery_api_key()
.with_config(|config| {
config.model = Some(requested_model.to_string());
config.developer_instructions = Some(developer_instructions.to_string());
@@ -878,7 +878,7 @@ async fn remote_models_remote_model_uses_unified_exec() -> Result<()> {
.await;
let mut builder = test_codex()
.with_auth(CodexAuth::create_dummy_chatgpt_auth_for_testing())
.with_catalog_discovery_api_key()
.with_config(|config| {
config.model = Some("gpt-5.4".to_string());
});
@@ -1005,7 +1005,7 @@ async fn remote_models_truncation_policy_without_override_preserves_remote() ->
.await;
let mut builder = test_codex()
.with_auth(CodexAuth::create_dummy_chatgpt_auth_for_testing())
.with_catalog_discovery_api_key()
.with_config(|config| {
config.model = Some("gpt-5.4".to_string());
});
@@ -1051,7 +1051,7 @@ async fn remote_models_truncation_policy_with_tool_output_override() -> Result<(
.await;
let mut builder = test_codex()
.with_auth(CodexAuth::create_dummy_chatgpt_auth_for_testing())
.with_catalog_discovery_api_key()
.with_config(|config| {
config.model = Some("gpt-5.4".to_string());
config.tool_output_token_limit = Some(50);
@@ -1072,7 +1072,7 @@ async fn remote_models_truncation_policy_with_tool_output_override() -> Result<(
Ok(())
}
#[test_case(CodexAuth::create_dummy_chatgpt_auth_for_testing(); "chatgpt")]
#[test_case(CodexAuth::from_api_key("Test API Key"); "chatgpt")]
#[test_case(CodexAuth::from_api_key("test-api-key"); "api key")]
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn remote_models_apply_legacy_instructions(auth: CodexAuth) -> Result<()> {
@@ -1289,7 +1289,7 @@ async fn remote_models_do_not_append_removed_builtin_presets() -> Result<()> {
let codex_home = TempDir::new()?;
let auth = CodexAuth::create_dummy_chatgpt_auth_for_testing();
let auth = CodexAuth::from_api_key("Test API Key");
let provider = ModelProviderInfo {
base_url: Some(format!("{}/v1", server.uri())),
..built_in_model_providers(/* openai_base_url */ /*openai_base_url*/ None)["openai"].clone()
@@ -1355,7 +1355,7 @@ async fn remote_models_merge_adds_new_high_priority_first() -> Result<()> {
let codex_home = TempDir::new()?;
let auth = CodexAuth::create_dummy_chatgpt_auth_for_testing();
let auth = CodexAuth::from_api_key("Test API Key");
let provider = ModelProviderInfo {
base_url: Some(format!("{}/v1", server.uri())),
..built_in_model_providers(/* openai_base_url */ /*openai_base_url*/ None)["openai"].clone()
@@ -1407,7 +1407,7 @@ async fn remote_models_merge_replaces_overlapping_model() -> Result<()> {
let codex_home = TempDir::new()?;
let auth = CodexAuth::create_dummy_chatgpt_auth_for_testing();
let auth = CodexAuth::from_api_key("Test API Key");
let provider = ModelProviderInfo {
base_url: Some(format!("{}/v1", server.uri())),
..built_in_model_providers(/* openai_base_url */ /*openai_base_url*/ None)["openai"].clone()
@@ -1456,7 +1456,7 @@ async fn remote_models_merge_preserves_bundled_models_on_empty_response() -> Res
let codex_home = TempDir::new()?;
let auth = CodexAuth::create_dummy_chatgpt_auth_for_testing();
let auth = CodexAuth::from_api_key("Test API Key");
let provider = ModelProviderInfo {
base_url: Some(format!("{}/v1", server.uri())),
..built_in_model_providers(/* openai_base_url */ /*openai_base_url*/ None)["openai"].clone()
@@ -1503,7 +1503,7 @@ async fn remote_models_request_times_out_after_5s() -> Result<()> {
let codex_home = TempDir::new()?;
let auth = CodexAuth::create_dummy_chatgpt_auth_for_testing();
let auth = CodexAuth::from_api_key("Test API Key");
let provider = ModelProviderInfo {
base_url: Some(format!("{}/v1", server.uri())),
..built_in_model_providers(/* openai_base_url */ /*openai_base_url*/ None)["openai"].clone()
@@ -1578,7 +1578,7 @@ async fn remote_models_hide_picker_only_models() -> Result<()> {
let codex_home = TempDir::new()?;
let auth = CodexAuth::create_dummy_chatgpt_auth_for_testing();
let auth = CodexAuth::from_api_key("Test API Key");
let provider = ModelProviderInfo {
base_url: Some(format!("{}/v1", server.uri())),
..built_in_model_providers(/* openai_base_url */ /*openai_base_url*/ None)["openai"].clone()