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

@@ -224,11 +224,7 @@ impl Fixture {
let url = format!("http://{}", listener.local_addr()?);
let server = tokio::spawn(async move { axum::serve(listener, router).await });
let home = tempfile::tempdir()?;
let auth_value = CodexAuth::from_external_chatgpt_tokens(
"header.e30.first",
"account",
/*chatgpt_plan_type*/ None,
)?;
let auth_value = CodexAuth::from_api_key("Test API Key");
let auth =
AuthManager::from_auth_for_testing_with_home(auth_value.clone(), home.path().into());
let config = ConfigBuilder::default()
@@ -277,7 +273,6 @@ impl Fixture {
let startup_cancellation_token = CancellationToken::new();
let runtime_input = || McpRuntimeInput {
network_policy_metadata: None,
runtime_auth: None,
startup_policy: McpStartupPolicy::Eager,
config: Arc::clone(&config),
plugins_available: false,
@@ -585,11 +580,7 @@ async fn apps_resource_discovery_discards_page_after_account_switch() -> Result<
}
let previous_auth = reader.auth_cache_key_for_server(CODEX_APPS_MCP_SERVER_NAME);
let next_auth = CodexAuth::from_external_chatgpt_tokens(
"header.e30.second",
"second-account",
/*chatgpt_plan_type*/ None,
)?;
let next_auth = CodexAuth::from_api_key("second-account-key");
fixture
.auth
.set_external_auth(Arc::new(StaticAuth(next_auth.clone())))
@@ -619,34 +610,3 @@ impl ExternalAuth for StaticAuth {
}
}
#[tokio::test]
async fn event_connections_open_after_runtime_shutdown_with_current_auth() -> Result<()> {
let mut fixture = Fixture::new().await?;
let opener = McpResourceClient::new(Arc::clone(&fixture.runtime)).event_stream_opener()?;
fixture.runtime.shutdown().await;
drop(fixture.runtime);
fixture
.auth
.set_external_auth(Arc::new(StaticAuth(
CodexAuth::from_external_chatgpt_tokens(
"header.e30.refreshed",
"account",
/*chatgpt_plan_type*/ None,
)?,
)))
.await?;
let mut stream = opener
.open("test.event", &json!({}), /*request_meta*/ None)
.await?;
let remote = timeout(WAIT, fixture.opened.recv()).await?.unwrap();
assert_eq!(
remote.headers["authorization"],
"Bearer header.e30.refreshed"
);
let expected = remote.notify("notifications/events/active");
assert_eq!(timeout(WAIT, stream.recv()).await??, Some(expected));
drop(stream);
timeout(WAIT, remote.notifications.closed()).await?;
Ok(())
}

View File

@@ -326,13 +326,9 @@ async fn access_changes_cancel_streams_with_full_output() -> Result<()> {
} else {
fixture
.auth
.set_external_auth(Arc::new(StaticAuth(
CodexAuth::from_external_chatgpt_tokens(
"header.e30.other",
"other-account",
/*chatgpt_plan_type*/ None,
)?,
)))
.set_external_auth(Arc::new(StaticAuth(CodexAuth::from_api_key(
"other-account-key",
))))
.await?;
}
// Access changes close the stream even while its output is blocked.

View File

@@ -787,7 +787,7 @@ async fn run_cloud_plugin_projection_scenarios() -> anyhow::Result<()> {
install_plugin_providers(&mut extensions, providers);
let mut builder = test_codex()
.with_extensions(Arc::new(extensions.build()))
.with_auth(CodexAuth::create_dummy_chatgpt_auth_for_testing())
.with_auth(CodexAuth::from_api_key("Test API Key"))
.with_model_info_override("gpt-5.5", |model| model.supports_search_tool = false)
.with_config(move |config| {
assert!(config.features.enable(Feature::Plugins).is_ok());