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

@@ -18,7 +18,6 @@ use codex_features::Feature;
use codex_http_client::OutboundProxyPolicy;
use codex_login::AuthManager;
use codex_login::CodexAuth;
use codex_login::auth::AgentIdentityAuthPolicy;
use codex_model_provider_info::ModelProviderInfo;
use codex_model_provider_info::WireApi;
use codex_otel::MetricsClient;
@@ -84,9 +83,6 @@ use tempfile::TempDir;
use tracing::Instrument;
use tracing_test::traced_test;
#[path = "client_websockets_runtime_auth.rs"]
mod runtime_auth_tests;
const MODEL: &str = "gpt-5.4";
const OPENAI_BETA_HEADER: &str = "OpenAI-Beta";
const USER_AGENT_HEADER: &str = "user-agent";
@@ -351,7 +347,7 @@ async fn responses_websocket_omits_routing_hint_for_provider_with_own_credential
/*runtime_metrics_enabled*/ false,
/*concurrent_reasoning_summaries_enabled*/ false,
/*enabled_features*/ &[],
Some(CodexAuth::create_dummy_chatgpt_auth_for_testing()),
Some(CodexAuth::from_api_key("Test API Key")),
)
.await;
let mut client_session = harness.client.new_session();
@@ -1080,21 +1076,11 @@ async fn responses_websocket_reconnects_after_account_switch() {
for index in 1..=5 {
if index == 3 {
let mut tokens = harness
.auth_manager
.auth_cached()
.unwrap()
.get_token_data()
.unwrap();
tokens.id_token.raw_jwt = "e30.e30.signature".into();
tokens.account_id = Some("second-account".into());
tokens.access_token = "second-account-token".into();
std::fs::write(
harness.codex_home.path().join("auth.json"),
serde_json::to_vec(&json!({
"auth_mode": "chatgpt",
"tokens": tokens,
"last_refresh": chrono::Utc::now(),
"auth_mode": "apikey",
"OPENAI_API_KEY": "second-account-token",
}))
.unwrap(),
)
@@ -1137,14 +1123,8 @@ async fn responses_websocket_reconnects_after_account_switch() {
))
.collect::<Vec<_>>(),
vec![
(
Some("account_id".into()),
Some("Bearer Access Token".into())
),
(
Some("second-account".into()),
Some("Bearer second-account-token".into())
),
(None, Some("Bearer Test API Key".into())),
(None, Some("Bearer second-account-token".into())),
],
);
assert_eq!(
@@ -2894,7 +2874,7 @@ async fn websocket_harness_for_codex_backend(server: &WebSocketTestServer) -> We
/*runtime_metrics_enabled*/ false,
/*concurrent_reasoning_summaries_enabled*/ false,
/*enabled_features*/ &[],
Some(CodexAuth::create_dummy_chatgpt_auth_for_testing()),
Some(CodexAuth::from_api_key("Test API Key")),
)
.await
}
@@ -3048,7 +3028,6 @@ async fn websocket_harness_with_provider_factory(
});
let client = ModelClient::new(
provider_factory(provider.clone(), client_auth_manager),
AgentIdentityAuthPolicy::JwtOnly,
thread_id,
codex_protocol_test_support::uuid_v7_item_id_generator_for_test(),
SessionSource::Exec,
@@ -3066,7 +3045,6 @@ async fn websocket_harness_with_provider_factory(
config.features.enabled(Feature::OutputTokenReplay),
/*attestation_provider*/ None,
http_client_factory,
config.workspace_routing_context(),
request_contributors,
);