Rimossi i provider integrati OpenAI, Bedrock e GCP e ogni fallback a OpenAI (B)
Parte "sicurezza" della fase 3 di aKode (e39aae00), senza le funzioni di imeAI:
- via i provider integrati openai, amazon-bedrock, amazon-bedrock-runtime e gcp
(crate model-provider: moduli amazon_bedrock, gcp, chatgpt_base_url; login Bedrock;
onboarding Bedrock/GCP; richieste app-server di setup cloud);
- nessun URL predefinito verso api.openai.com / chatgpt.com: un provider senza
base_url non viene mai contattato; senza model_provider configurato exec e TUI
mostrano come scriverne uno in config.toml (NO_MODEL_PROVIDER_CONFIGURED_ERROR);
- via la skill openai-docs, la sample skill-installer (scaricava da github.com/openai/skills),
request_plugin_install, AppsInstructions, URL predefiniti di realtime e updater;
- test di sicurezza adattati (provider "mock" al posto di quello integrato), non cancellati.
Restano fuori da questo commit (categoria F/D/E, non portate): chiave per provider nel
portachiavi, modelli da /models, unione dei messaggi di sistema, crate web-tools e
SearXNG, header @@ in apply_patch, modello ausiliario, tool function per apply_patch.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,7 +3,6 @@ use std::time::Duration;
|
||||
use anyhow::Error;
|
||||
use anyhow::Result;
|
||||
use app_test_support::TestAppServer;
|
||||
use app_test_support::write_models_cache;
|
||||
use codex_app_server_protocol::ClientRequest;
|
||||
use codex_app_server_protocol::ExperimentalFeatureEnablementSetParams;
|
||||
use codex_app_server_protocol::ExperimentalFeatureEnablementSetResponse;
|
||||
@@ -165,7 +164,9 @@ requires_openai_auth = true
|
||||
// prevents bundled models from being advertised for this provider.
|
||||
&[]
|
||||
} else {
|
||||
&bundled
|
||||
// aKode: without `model_catalog_url` the provider's OpenAI-format `GET /models`
|
||||
// listing is the source (no bundled catalog); this codex-format body lists nothing.
|
||||
&[]
|
||||
};
|
||||
assert_eq!(
|
||||
response,
|
||||
@@ -174,8 +175,20 @@ requires_openai_auth = true
|
||||
next_cursor: None,
|
||||
}
|
||||
);
|
||||
let _ = bundled;
|
||||
if !catalog_opt_in {
|
||||
// aKode: providers without a catalog URL list their models from `GET /models`.
|
||||
assert!(
|
||||
server
|
||||
.received_requests()
|
||||
.await
|
||||
.expect("request recording is enabled")
|
||||
.iter()
|
||||
.any(|request| request.url.path() == "/v1/models")
|
||||
);
|
||||
}
|
||||
// Only startup opt-outs prevent fetches before the app sends its enablement.
|
||||
if user_enablement == Some(false) || !catalog_opt_in {
|
||||
if user_enablement == Some(false) {
|
||||
assert!(
|
||||
server
|
||||
.received_requests()
|
||||
@@ -235,6 +248,15 @@ fn model_from_preset(preset: &ModelPreset) -> Model {
|
||||
}
|
||||
}
|
||||
|
||||
/// aKode: providers without `model_catalog_url` no longer fall back to the bundled
|
||||
/// catalog (or read `models_cache.json`), so the listing tests configure it explicitly.
|
||||
fn write_bundled_model_catalog_config(codex_home: &std::path::Path) -> std::io::Result<()> {
|
||||
std::fs::write(
|
||||
codex_home.join("config.toml"),
|
||||
app_test_support::bundled_model_catalog_config(codex_home)?,
|
||||
)
|
||||
}
|
||||
|
||||
fn expected_visible_models() -> Vec<Model> {
|
||||
// Filter by supported_in_api to support testing with both ChatGPT and non-ChatGPT auth modes.
|
||||
let mut presets = ModelPreset::filter_by_auth(
|
||||
@@ -255,7 +277,7 @@ fn expected_visible_models() -> Vec<Model> {
|
||||
#[tokio::test]
|
||||
async fn list_models_returns_all_models_with_large_limit() -> Result<()> {
|
||||
let codex_home = TempDir::new()?;
|
||||
write_models_cache(codex_home.path()).await?;
|
||||
write_bundled_model_catalog_config(codex_home.path())?;
|
||||
let mut mcp = TestAppServer::builder()
|
||||
.with_codex_home(codex_home.path())
|
||||
.without_auto_env()
|
||||
@@ -286,7 +308,7 @@ async fn list_models_returns_all_models_with_large_limit() -> Result<()> {
|
||||
#[tokio::test]
|
||||
async fn list_models_includes_hidden_models() -> Result<()> {
|
||||
let codex_home = TempDir::new()?;
|
||||
write_models_cache(codex_home.path()).await?;
|
||||
write_bundled_model_catalog_config(codex_home.path())?;
|
||||
let mut mcp = TestAppServer::builder()
|
||||
.with_codex_home(codex_home.path())
|
||||
.without_auto_env()
|
||||
@@ -471,7 +493,7 @@ model_catalog_url = "{server_uri}/v1/models"
|
||||
#[tokio::test]
|
||||
async fn list_models_pagination_works() -> Result<()> {
|
||||
let codex_home = TempDir::new()?;
|
||||
write_models_cache(codex_home.path()).await?;
|
||||
write_bundled_model_catalog_config(codex_home.path())?;
|
||||
let mut mcp = TestAppServer::builder()
|
||||
.with_codex_home(codex_home.path())
|
||||
.without_auto_env()
|
||||
@@ -518,7 +540,7 @@ async fn list_models_pagination_works() -> Result<()> {
|
||||
#[tokio::test]
|
||||
async fn list_models_rejects_invalid_cursor() -> Result<()> {
|
||||
let codex_home = TempDir::new()?;
|
||||
write_models_cache(codex_home.path()).await?;
|
||||
write_bundled_model_catalog_config(codex_home.path())?;
|
||||
let mut mcp = TestAppServer::builder()
|
||||
.with_codex_home(codex_home.path())
|
||||
.without_auto_env()
|
||||
|
||||
Reference in New Issue
Block a user