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:
@@ -79,34 +79,14 @@ async fn start_thread_with_model(
|
||||
.await
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn thread_start_provider_model_fallback_applies_to_configured_model() -> Result<()> {
|
||||
let codex_home = TempDir::new()?;
|
||||
std::fs::write(
|
||||
codex_home.path().join("config.toml"),
|
||||
r#"model_provider = "amazon-bedrock"
|
||||
model = "gpt-5.4-mini"
|
||||
"#,
|
||||
)?;
|
||||
let mut mcp = TestAppServer::builder()
|
||||
.with_codex_home(codex_home.path())
|
||||
.build_initialized()
|
||||
.await?;
|
||||
|
||||
let response = mcp
|
||||
.start_thread(ThreadStartParams {
|
||||
allow_provider_model_fallback: true,
|
||||
..Default::default()
|
||||
})
|
||||
.await?;
|
||||
|
||||
assert_eq!(response.model, "openai.gpt-6.1-sol");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn thread_start_warns_for_exec_policy_parse_failure_after_initialize() -> Result<()> {
|
||||
let codex_home = TempDir::new()?;
|
||||
// aKode: no default provider or bundled catalog; threads need an explicit catalog.
|
||||
std::fs::write(
|
||||
codex_home.path().join("config.toml"),
|
||||
app_test_support::bundled_model_catalog_config(codex_home.path())?,
|
||||
)?;
|
||||
let mut mcp = TestAppServer::builder()
|
||||
.with_codex_home(codex_home.path())
|
||||
.build_initialized()
|
||||
@@ -175,6 +155,11 @@ async fn thread_start_warns_for_exec_policy_parse_failure_after_initialize() ->
|
||||
#[tokio::test]
|
||||
async fn thread_start_does_not_repeat_initialize_exec_policy_warning() -> Result<()> {
|
||||
let codex_home = TempDir::new()?;
|
||||
// aKode: no default provider or bundled catalog; threads need an explicit catalog.
|
||||
std::fs::write(
|
||||
codex_home.path().join("config.toml"),
|
||||
app_test_support::bundled_model_catalog_config(codex_home.path())?,
|
||||
)?;
|
||||
let rules_dir = codex_home.path().join("rules");
|
||||
std::fs::create_dir_all(&rules_dir)?;
|
||||
std::fs::write(rules_dir.join("broken.rules"), "prefix_rule(")?;
|
||||
@@ -210,103 +195,6 @@ async fn thread_start_does_not_repeat_initialize_exec_policy_warning() -> Result
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn thread_start_provider_model_fallback_uses_bedrock_static_catalog() -> Result<()> {
|
||||
let codex_home = TempDir::new()?;
|
||||
std::fs::write(
|
||||
codex_home.path().join("config.toml"),
|
||||
r#"model_provider = "amazon-bedrock"
|
||||
"#,
|
||||
)?;
|
||||
let mut mcp = TestAppServer::builder()
|
||||
.with_codex_home(codex_home.path())
|
||||
.build_initialized()
|
||||
.await?;
|
||||
|
||||
let unsupported_with_fallback = start_thread_with_model(
|
||||
&mut mcp,
|
||||
"gpt-5.4-mini",
|
||||
/*allow_provider_model_fallback*/ true,
|
||||
)
|
||||
.await?;
|
||||
for model in [
|
||||
"openai.gpt-6.1-sol",
|
||||
"openai.gpt-6.1-terra",
|
||||
"openai.gpt-6-sol",
|
||||
"openai.gpt-6-luna",
|
||||
"openai.gpt-5.6-sol",
|
||||
] {
|
||||
let response =
|
||||
start_thread_with_model(&mut mcp, model, /*allow_provider_model_fallback*/ true)
|
||||
.await?;
|
||||
assert_eq!(response.model, model);
|
||||
}
|
||||
let supported_with_fallback = start_thread_with_model(
|
||||
&mut mcp,
|
||||
"openai.gpt-5.5",
|
||||
/*allow_provider_model_fallback*/ true,
|
||||
)
|
||||
.await?;
|
||||
let unsupported_without_fallback = start_thread_with_model(
|
||||
&mut mcp,
|
||||
"gpt-5.4-mini",
|
||||
/*allow_provider_model_fallback*/ false,
|
||||
)
|
||||
.await?;
|
||||
|
||||
assert_eq!(
|
||||
vec![
|
||||
unsupported_with_fallback.model,
|
||||
supported_with_fallback.model,
|
||||
unsupported_without_fallback.model,
|
||||
],
|
||||
vec!["openai.gpt-6.1-sol", "openai.gpt-5.5", "gpt-5.4-mini"]
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn thread_start_bedrock_runtime_prefers_global_cross_region_models() -> Result<()> {
|
||||
let codex_home = TempDir::new()?;
|
||||
std::fs::write(
|
||||
codex_home.path().join("config.toml"),
|
||||
r#"model_provider = "amazon-bedrock-runtime"
|
||||
"#,
|
||||
)?;
|
||||
let mut mcp = TestAppServer::builder()
|
||||
.with_codex_home(codex_home.path())
|
||||
.build_initialized()
|
||||
.await?;
|
||||
|
||||
for model in [
|
||||
"global.openai.gpt-6.1-sol",
|
||||
"us.openai.gpt-6.1-sol",
|
||||
"global.openai.gpt-6.1-terra",
|
||||
"us.openai.gpt-6.1-terra",
|
||||
"global.openai.gpt-6-sol",
|
||||
"us.openai.gpt-6-sol",
|
||||
"global.openai.gpt-6-luna",
|
||||
"us.openai.gpt-6-luna",
|
||||
"global.openai.gpt-5.6-sol",
|
||||
"us.openai.gpt-5.6-sol",
|
||||
] {
|
||||
let response =
|
||||
start_thread_with_model(&mut mcp, model, /*allow_provider_model_fallback*/ true)
|
||||
.await?;
|
||||
assert_eq!(response.model, model);
|
||||
}
|
||||
|
||||
let response = start_thread_with_model(
|
||||
&mut mcp,
|
||||
"openai.gpt-5.6-sol",
|
||||
/*allow_provider_model_fallback*/ true,
|
||||
)
|
||||
.await?;
|
||||
assert_eq!(response.model, "global.openai.gpt-6.1-sol");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn thread_start_provider_model_fallback_ignores_dynamic_catalog() -> Result<()> {
|
||||
let server = create_mock_responses_server_repeating_assistant("Done").await;
|
||||
|
||||
Reference in New Issue
Block a user