aKode fase 2b-2: rimosso login ChatGPT e tutti i sottosistemi solo-ChatGPT
- Login: resta solo chiave API (+ header, Bedrock). Rimossi OAuth/browser, device code, refresh/revoke su auth.openai.com, PAT, agent/workload identity, runtime agent instance, backend-client e openapi-models, workspace routing. - Rimossi: generazione immagini (ext + skill imagegen), history notes, plugin remoti (catalogo, sync, share), cyber access program, daybreak, cloud config e requirements (config_server ora fail-closed), attestation, frozen cloud skills, EMA MCP auth, Codex Apps/connettori, ricerca ospitata, header/zstd/ routing/cookie del backend Codex, fallback OPENAI_API_KEY del realtime. - Messaggi d'errore senza link a chatgpt.com. - Chiavi di config legacy accettate e ignorate; feature rimosse = Stage::Removed. - Test: cancellati solo quelli del codice rimosso; test di sicurezza (sandbox estensioni, permessi, redazione, auth storage, requirements) adattati. Restano solo fallimenti d'ambiente (code-mode-host/V8, ~/.agents). - Istruzioni di sistema invariate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,9 +2,7 @@ use std::time::Duration;
|
||||
|
||||
use anyhow::Error;
|
||||
use anyhow::Result;
|
||||
use app_test_support::ChatGptAuthFixture;
|
||||
use app_test_support::TestAppServer;
|
||||
use app_test_support::write_chatgpt_auth;
|
||||
use app_test_support::write_models_cache;
|
||||
use codex_app_server_protocol::ClientRequest;
|
||||
use codex_app_server_protocol::ExperimentalFeatureEnablementSetParams;
|
||||
@@ -20,7 +18,6 @@ use codex_app_server_protocol::RequestId;
|
||||
use codex_config::types::AuthCredentialsStoreMode;
|
||||
use codex_login::AuthKeyringBackendKind;
|
||||
use codex_login::login_with_api_key;
|
||||
use codex_protocol::openai_models::MODEL_SPECIALTY_CYBER;
|
||||
use codex_protocol::openai_models::ModelInfo;
|
||||
use codex_protocol::openai_models::ModelPreset;
|
||||
use codex_protocol::openai_models::ModelsResponse;
|
||||
@@ -234,7 +231,6 @@ fn model_from_preset(preset: &ModelPreset) -> Model {
|
||||
})
|
||||
.collect(),
|
||||
default_service_tier: preset.default_service_tier.clone(),
|
||||
available_access_programs: preset.available_access_programs.clone().map(Into::into),
|
||||
is_default: preset.is_default,
|
||||
}
|
||||
}
|
||||
@@ -316,13 +312,10 @@ async fn list_models_includes_hidden_models() -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test_case("chatgpt-access-token", None; "chatgpt")]
|
||||
#[test_case("test-api-key", Some("test-api-key"); "api key")]
|
||||
#[test_case("test-api-key"; "api key")]
|
||||
#[tokio::test]
|
||||
async fn list_models_uses_remote_catalog_as_source_of_truth(
|
||||
bearer_token: &str,
|
||||
api_key: Option<&str>,
|
||||
) -> Result<()> {
|
||||
async fn list_models_uses_remote_catalog_as_source_of_truth(api_key: &str) -> Result<()> {
|
||||
let bearer_token = api_key;
|
||||
let server = MockServer::start().await;
|
||||
let remote_models = [
|
||||
(
|
||||
@@ -340,7 +333,7 @@ async fn list_models_uses_remote_catalog_as_source_of_truth(
|
||||
"slug": format!("remote-only-{priority}"),
|
||||
"display_name": "Remote Only",
|
||||
"description": "Remote-only model for app-server model/list coverage",
|
||||
"model_specialty": MODEL_SPECIALTY_CYBER,
|
||||
// Legacy catalog metadata must still be accepted and ignored.
|
||||
"available_access_programs": access_programs,
|
||||
"default_reasoning_level": "max",
|
||||
"supported_reasoning_levels": [
|
||||
@@ -403,20 +396,12 @@ model_catalog_url = "{server_uri}/v1/models"
|
||||
"#
|
||||
),
|
||||
)?;
|
||||
if let Some(api_key) = api_key {
|
||||
login_with_api_key(
|
||||
codex_home.path(),
|
||||
api_key,
|
||||
AuthCredentialsStoreMode::File,
|
||||
AuthKeyringBackendKind::default(),
|
||||
)?;
|
||||
} else {
|
||||
write_chatgpt_auth(
|
||||
codex_home.path(),
|
||||
ChatGptAuthFixture::new(bearer_token).plan_type("pro"),
|
||||
AuthCredentialsStoreMode::File,
|
||||
)?;
|
||||
}
|
||||
login_with_api_key(
|
||||
codex_home.path(),
|
||||
api_key,
|
||||
AuthCredentialsStoreMode::File,
|
||||
AuthKeyringBackendKind::default(),
|
||||
)?;
|
||||
|
||||
let mut mcp = TestAppServer::builder()
|
||||
.with_codex_home(codex_home.path())
|
||||
@@ -448,14 +433,9 @@ model_catalog_url = "{server_uri}/v1/models"
|
||||
.as_array()
|
||||
.expect("model/list data should be an array")
|
||||
.iter()
|
||||
.map(|model| model["availableAccessPrograms"].clone())
|
||||
.map(|model| model.get("availableAccessPrograms").cloned())
|
||||
.collect::<Vec<_>>(),
|
||||
vec![
|
||||
json!({ "cyber": ["standard", "daybreakBlue"] }),
|
||||
json!({ "cyber": ["daybreakRed"] }),
|
||||
json!({ "cyber": [] }),
|
||||
json!(null),
|
||||
]
|
||||
vec![None; 4]
|
||||
);
|
||||
let ModelListResponse {
|
||||
data: items,
|
||||
|
||||
Reference in New Issue
Block a user