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:
andrea.difonzo
2026-11-10 16:20:15 +01:00
parent 82347a58ed
commit 6089fbde91
1573 changed files with 10289 additions and 177679 deletions

View File

@@ -1,11 +1,9 @@
//! GCP account reporting follows the selected provider without resolving its credentials.
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_api_key_auth;
use codex_app_server_protocol::GetAccountParams;
use codex_config::types::AuthCredentialsStoreMode;
use pretty_assertions::assert_eq;
use serde_json::Value;
use serde_json::json;
@@ -38,32 +36,23 @@ async fn gcp_account_is_reported_without_resolving_credentials(overrides: &str)
.build_initialized()
.await?;
for refresh_token in [false, true] {
let request_id = app_server
.send_get_account_request(GetAccountParams { refresh_token })
.await?;
let received: Value = timeout(READ_TIMEOUT, app_server.read_response(request_id)).await??;
assert_eq!(
received,
json!({"account": {"type": "gcp"}, "userId": null, "requiresOpenaiAuth": false, "workspaceRouting": null})
);
}
let request_id = app_server
.send_get_account_request(GetAccountParams {})
.await?;
let received: Value = timeout(READ_TIMEOUT, app_server.read_response(request_id)).await??;
assert_eq!(
received,
json!({"account": {"type": "gcp"}, "requiresOpenaiAuth": false})
);
Ok(())
}
#[tokio::test]
async fn gcp_account_tracks_provider_changes_with_saved_chatgpt_credentials() -> Result<()> {
async fn gcp_account_tracks_provider_changes_with_saved_api_key() -> Result<()> {
let codex_home = TempDir::new()?;
let config_path = codex_home.path().join("config.toml");
std::fs::write(&config_path, "model_provider = \"gcp\"\n")?;
write_chatgpt_auth(
codex_home.path(),
ChatGptAuthFixture::new("access-chatgpt")
.email("user@example.com")
.chatgpt_user_id("user-saved")
.plan_type("pro"),
AuthCredentialsStoreMode::File,
)?;
write_api_key_auth(codex_home.path())?;
let mut app_server = TestAppServer::builder()
.with_codex_home(codex_home.path())
.with_env_overrides(&[("OPENAI_API_KEY", None)])
@@ -73,26 +62,24 @@ async fn gcp_account_tracks_provider_changes_with_saved_chatgpt_credentials() ->
for (provider, expected) in [
(
"gcp",
json!({"account": {"type": "gcp"}, "userId": null, "requiresOpenaiAuth": false, "workspaceRouting": null}),
json!({"account": {"type": "gcp"}, "requiresOpenaiAuth": false}),
),
(
"amazon-bedrock",
json!({"account": {"type": "amazonBedrock", "usesCodexManagedCredentials": false}, "userId": null, "requiresOpenaiAuth": false, "workspaceRouting": null}),
json!({"account": {"type": "amazonBedrock", "usesCodexManagedCredentials": false}, "requiresOpenaiAuth": false}),
),
(
"openai",
json!({"account": {"type": "chatgpt", "email": "user@example.com", "planType": "pro", "workspaceName": null}, "userId": "user-saved", "requiresOpenaiAuth": true, "workspaceRouting": null}),
json!({"account": {"type": "apiKey"}, "requiresOpenaiAuth": true}),
),
(
"gcp",
json!({"account": {"type": "gcp"}, "userId": null, "requiresOpenaiAuth": false, "workspaceRouting": null}),
json!({"account": {"type": "gcp"}, "requiresOpenaiAuth": false}),
),
] {
std::fs::write(&config_path, format!("model_provider = \"{provider}\"\n"))?;
let request_id = app_server
.send_get_account_request(GetAccountParams {
refresh_token: false,
})
.send_get_account_request(GetAccountParams {})
.await?;
let received: Value = timeout(READ_TIMEOUT, app_server.read_response(request_id)).await??;
assert_eq!(received, expected);