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:
andrea.difonzo
2026-11-17 12:31:29 +01:00
parent 22a79feba1
commit 2f8b6a3e16
481 changed files with 4319 additions and 25142 deletions

View File

@@ -473,13 +473,11 @@ async fn tool_call_metadata_stays_out_of_raw_response_item_notifications() -> Re
.find(|item| item["type"] == "function_call_output" && item["call_id"] == "mcp-call")
.context("follow-up tool output")?;
assert!(serde_json::to_string(&output["output"])?.contains("Calendar result"));
// aKode: internal metadata passthrough is stripped from model requests unless the
// provider holds the runtime-only `include_internal_metadata` grant.
assert_eq!(
output["internal_chat_message_metadata_passthrough"]["executed_tool_calls"],
json!([{"name": DIRECT_CALENDAR_LIST_EVENTS_TOOL, "arguments": arguments}]),
);
assert_eq!(
output["internal_chat_message_metadata_passthrough"]["tool_calls_complete"],
true,
output.get("internal_chat_message_metadata_passthrough"),
None
);
let raw_output = &raw_params["item"];
@@ -488,10 +486,10 @@ async fn tool_call_metadata_stays_out_of_raw_response_item_notifications() -> Re
let public_metadata = raw_output["internal_chat_message_metadata_passthrough"]
.as_object()
.context("public passthrough metadata")?;
assert_eq!(
public_metadata.get("turn_id").context("public turn id")?,
&output["internal_chat_message_metadata_passthrough"]["turn_id"],
);
let public_turn_id = public_metadata
.get("turn_id")
.context("public turn id")?
.clone();
for field in ["executed_tool_calls", "tool_calls_complete", "cell_id"] {
assert!(
public_metadata.get(field).is_none(),
@@ -514,6 +512,14 @@ async fn tool_call_metadata_stays_out_of_raw_response_item_notifications() -> Re
.find(|item| item["type"] == "function_call_output" && item["call_id"] == "mcp-call")
.context("persisted MCP output")?;
assert_eq!(captured["output"], raw_output["output"]);
assert_eq!(
captured["internal_chat_message_metadata_passthrough"]["turn_id"],
public_turn_id
);
assert_eq!(
captured["internal_chat_message_metadata_passthrough"]["executed_tool_calls"][0]["name"],
json!(DIRECT_CALENDAR_LIST_EVENTS_TOOL),
);
// Raw MCP result metadata is never recorded, not even in the local rollout.
assert_eq!(
captured["internal_chat_message_metadata_passthrough"]["executed_tool_calls"][0]
@@ -644,7 +650,10 @@ async fn turn_start_steers_active_turn_and_returns_active_turn_id() -> Result<()
std::fs::write(
codex_home.path().join("config.toml"),
format!(
"model = \"gpt-5.5\"\napproval_policy = \"never\"\nopenai_base_url = \"{}/v1\"\ncli_auth_credentials_store = \"file\"\n[features]\nenable_request_compression = false\n",
// aKode: `openai_base_url` no longer configures a built-in provider; declare an
// equivalent `openai` provider explicitly, with an explicit model catalog.
"{}model = \"gpt-5.5\"\napproval_policy = \"never\"\nmodel_provider = \"openai\"\ncli_auth_credentials_store = \"file\"\n[features]\nenable_request_compression = false\n[model_providers.openai]\nname = \"OpenAI\"\nbase_url = \"{}/v1\"\nwire_api = \"responses\"\nrequires_openai_auth = true\nsupports_websockets = false\nmerge_system_messages = false\n",
app_test_support::bundled_model_catalog_config(codex_home.path())?,
server.uri()
),
)?;
@@ -1085,7 +1094,12 @@ async fn turn_start_emits_thread_scoped_warning_notification_for_trimmed_skills(
.expect("model slug should be present")
.to_string();
entry["context_window"] = serde_json::Value::from(100);
std::fs::write(&cache_path, serde_json::to_string_pretty(&cache)?)?;
// aKode: cached models are served through the explicit test catalog.
write_models_cache_with_models(
codex_home.path(),
serde_json::from_value(cache["models"].clone())?,
)
.await?;
let config_path = codex_home.path().join("config.toml");
let config = std::fs::read_to_string(&config_path)?;
std::fs::write(
@@ -1125,9 +1139,10 @@ async fn turn_start_emits_thread_scoped_warning_notification_for_trimmed_skills(
let warning: WarningNotification =
timeout(DEFAULT_READ_TIMEOUT, mcp.read_notification("warning")).await??;
assert_eq!(warning.thread_id.as_deref(), Some(thread.id.as_str()));
// aKode: the bundled `openai-docs` system skill was removed, so one fewer skill is trimmed.
assert_eq!(
warning.message,
"Exceeded skills context budget. All skill descriptions were removed and 5 additional skills were not included in the model-visible skills list."
"Exceeded skills context budget. All skill descriptions were removed and 4 additional skills were not included in the model-visible skills list."
);
timeout(
@@ -3270,13 +3285,14 @@ model = "mock-model"
approval_policy = "never"
default_permissions = "dev"
model_provider = "mock_provider"
{catalog}
[model_providers.mock_provider]
name = "Mock provider for test"
base_url = "{server_uri}/v1"
wire_api = "responses"
request_max_retries = 0
stream_max_retries = 0
merge_system_messages = false
# This test only exercises writable workspace roots; the Windows restricted-token
# sandbox cannot enforce a filesystem policy without root read access.
@@ -3285,7 +3301,9 @@ stream_max_retries = 0
[permissions.dev.filesystem.":workspace_roots"]
"." = "write"
"#
"#,
// aKode: explicit catalog (no bundled default) and upstream message layout.
catalog = app_test_support::bundled_model_catalog_config(&codex_home)?
),
)?;
@@ -3868,7 +3886,12 @@ async fn turn_start_streams_apply_patch_change_updates_v2() -> Result<()> {
model["slug"] = serde_json::Value::from("mock-model");
model["display_name"] = serde_json::Value::from("mock-model");
model["apply_patch_tool_type"] = serde_json::Value::from("freeform");
std::fs::write(&cache_path, serde_json::to_string_pretty(&cache)?)?;
// aKode: cached models are served through the explicit test catalog.
write_models_cache_with_models(
&codex_home,
serde_json::from_value(cache["models"].clone())?,
)
.await?;
let mut mcp = TestAppServer::builder()
.with_codex_home(&codex_home)