Eliminato chatgpt_base_url (B)

Da 24a3cfe2: via la chiave chatgpt_base_url e l'URL predefinito https://chatgpt.com/backend-api/
(la chiave resta accettata nei config e ignorata); schemi dell'app-server rigenerati.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
andrea.difonzo
2026-11-17 12:39:59 +01:00
parent 7effb5ec86
commit 499ee3a939
63 changed files with 160 additions and 532 deletions

View File

@@ -213,8 +213,6 @@ async fn run_agent_with_model(models_manager: SharedModelsManager, model_slug: &
.features
.enable(akode_features::Feature::RuntimeAgentInstances)
.expect("test config should allow enabling runtime auth");
// Model inference uses a third-party fixture; a custom ChatGPT base must not block startup.
config.chatgpt_base_url = "https://custom.example.test/backend-api".to_string();
});
let test = builder.build(&server).await?;
let available_models = test

View File

@@ -138,11 +138,7 @@ async fn entitlement_metadata_follows_the_actual_plugin_call(case: AccessCase) -
} else {
CodexAuth::from_api_key("Test API Key")
};
let base_url = server.uri();
let mut builder = test_codex()
.with_home(home)
.with_auth(auth)
.with_config(move |config| config.chatgpt_base_url = base_url);
let mut builder = test_codex().with_home(home).with_auth(auth);
if let Some(remote_url) = &remote_url {
builder = builder.with_exec_server_url(remote_url.clone());
}

View File

@@ -315,12 +315,10 @@ async fn legacy_remote_marketplace_plugin_commands_are_not_attributed() -> Resul
)
.await;
let chatgpt_base_url = server.uri();
let mut builder = builder
.with_home(Arc::clone(&codex_home))
.with_catalog_discovery_api_key()
.with_model("gpt-5.2")
.with_config(move |config| config.chatgpt_base_url = chatgpt_base_url);
.with_model("gpt-5.2");
let test_codex = builder.build_with_auto_env(&server).await?;
let codex = Arc::clone(&test_codex.codex);
let cwd = test_codex.config.cwd.clone();

View File

@@ -1316,13 +1316,11 @@ async fn reasoning_effort_override_unavailable_recovers_saved_history(
matches!(event, EventMsg::TurnComplete(_))
})
.await;
let chatgpt_base_url = format!("{}/backend-api", server.uri());
let mut builder = unavailable
.builder()
.with_auth(CodexAuth::from_api_key("Test API Key"))
.with_config(move |config| {
config.model_reasoning_effort = Some(ReasoningEffort::High);
config.chatgpt_base_url = chatgpt_base_url;
});
if let Some(url) = initial.executor_environment().exec_server_url() {
builder = builder.with_exec_server_url(url);
@@ -1671,7 +1669,6 @@ async fn reasoning_effort_override_compaction_fallback_uses_each_models_effort()
responses::sse(vec![responses::ev_completed("after")]),
)
.await;
let chatgpt_base_url = format!("{}/backend-api", server.uri());
let test = override_builder()
.with_auth(CodexAuth::from_api_key("Test API Key"))
.with_model_info_override("gpt-5.4", |model| {
@@ -1684,7 +1681,6 @@ async fn reasoning_effort_override_compaction_fallback_uses_each_models_effort()
})
.with_model("gpt-5.4")
.with_config(move |config| {
config.chatgpt_base_url = chatgpt_base_url;
config.model_provider.stream_max_retries = Some(0);
})
.build_with_auto_env(&server)

View File

@@ -4450,12 +4450,10 @@ async fn streamable_http_chatgpt_auth_is_not_sent_to_configured_origin() -> anyh
let untrusted_server = MockServer::start().await;
let untrusted_apps = McpTestServer::mount(&untrusted_server).await?;
let untrusted_mcp_url = format!("{}/mcp", untrusted_apps.base_url);
let untrusted_chatgpt_base_url = untrusted_apps.base_url;
let fixture = test_codex()
.with_auth(CodexAuth::from_api_key("Test API Key"))
.with_config(move |config| {
config.chatgpt_base_url = untrusted_chatgpt_base_url;
insert_mcp_server(
config,
"untrusted_origin",
@@ -4506,67 +4504,6 @@ async fn streamable_http_chatgpt_auth_is_not_sent_to_configured_origin() -> anyh
Ok(())
}
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
async fn configured_chatgpt_base_url_does_not_grant_mcp_chatgpt_auth() -> anyhow::Result<()> {
skip_if_no_network!(Ok(()));
let server = responses::start_mock_server().await;
let untrusted_server = MockServer::start().await;
let untrusted_apps = McpTestServer::mount(&untrusted_server).await?;
let untrusted_mcp_url = format!("{}/mcp", untrusted_apps.base_url);
let untrusted_chatgpt_base_url = untrusted_apps.base_url;
let fixture = test_codex()
.with_auth(CodexAuth::from_api_key("Test API Key"))
.with_pre_build_hook(move |codex_home| {
fs::write(
codex_home.join("config.toml"),
format!(
r#"
chatgpt_base_url = "{untrusted_chatgpt_base_url}"
[mcp_servers.untrusted_origin]
url = "{untrusted_mcp_url}"
auth = "chatgpt"
"#,
),
)
.expect("write attacker-controlled MCP config");
})
.build(&server)
.await?;
wait_for_mcp_server(&fixture.codex, "untrusted_origin").await?;
let observed_requests = untrusted_server
.received_requests()
.await
.expect("mock server should capture MCP startup requests")
.into_iter()
.filter(|request| request.url.path() == "/mcp")
.filter_map(|request| {
let body: Value = serde_json::from_slice(&request.body).ok()?;
let method = body.get("method")?.as_str()?.to_string();
let authorization = request
.headers
.get("authorization")
.and_then(|value| value.to_str().ok())
.map(str::to_string);
Some((method, authorization))
})
.collect::<Vec<_>>();
assert_eq!(
observed_requests,
vec![
("initialize".to_string(), None),
("notifications/initialized".to_string(), None),
("tools/list".to_string(), None),
],
);
Ok(())
}
/// This test writes to a fallback credentials file in AKODE_HOME.
/// Ideally, we wouldn't need to serialize the test but it's much more cumbersome to wire AKODE_HOME through the code.
#[test]

View File

@@ -2486,14 +2486,12 @@ async fn executor_skill_invocation_is_environment_scoped_and_deduplicated() -> R
.await;
let (extensions, _) = catalog_extensions(catalog, /*include_host_provider*/ false);
let chatgpt_base_url = server.uri();
let mut builder = test_codex()
.with_home(codex_home)
.with_auth(CodexAuth::from_api_key("Test API Key"))
.with_extensions(extensions)
.with_config(move |config| {
configure_catalog_test(config);
config.chatgpt_base_url = chatgpt_base_url;
});
let test = builder.build_with_auto_env(&server).await?;
test.submit_turn("Read the executor skill twice.").await?;