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

@@ -41,7 +41,6 @@ use wiremock::matchers::header;
use wiremock::matchers::method;
use wiremock::matchers::path;
const CHATGPT_ACCOUNT_ID: &str = "workspace-one";
const INITIAL_ACCESS_TOKEN: &str = "header.e30.initial";
const REFRESHED_ACCESS_TOKEN: &str = "header.e30.refreshed";
@@ -60,26 +59,21 @@ impl ExternalAuth for ScriptedExternalAuth {
Box::pin(async move { auth })
}
fn refresh(&self, context: ExternalAuthRefreshContext) -> ExternalAuthFuture<'_, CodexAuth> {
let auth = if context.previous_account_id.as_deref() != Some(CHATGPT_ACCOUNT_ID) {
Err(std::io::Error::other(
"external auth refresh changed the ChatGPT workspace",
))
} else {
self.current
.lock()
.map_err(|_| std::io::Error::other("external auth lock is poisoned"))
.map(|mut current| {
*current = self.refreshed.clone();
self.refreshed.clone()
})
};
fn refresh(&self, _context: ExternalAuthRefreshContext) -> ExternalAuthFuture<'_, CodexAuth> {
let auth = self
.current
.lock()
.map_err(|_| std::io::Error::other("external auth lock is poisoned"))
.map(|mut current| {
*current = self.refreshed.clone();
self.refreshed.clone()
});
Box::pin(async move { auth })
}
}
fn external_chatgpt_auth(access_token: &str) -> std::io::Result<CodexAuth> {
CodexAuth::from_external_chatgpt_tokens(access_token, CHATGPT_ACCOUNT_ID, Some("enterprise"))
fn external_bearer_auth(access_token: &str) -> CodexAuth {
CodexAuth::from_api_key(access_token)
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
@@ -722,7 +716,7 @@ async fn amazon_bedrock_aws_auth_refresh_resigns() -> anyhow::Result<()> {
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn external_auth_401_retry_uses_refreshed_chatgpt_headers() -> anyhow::Result<()> {
async fn external_auth_401_retry_uses_refreshed_headers() -> anyhow::Result<()> {
skip_if_no_network!(Ok(()));
let server = start_mock_server().await;
@@ -732,7 +726,6 @@ async fn external_auth_401_retry_uses_refreshed_chatgpt_headers() -> anyhow::Res
"authorization",
format!("Bearer {INITIAL_ACCESS_TOKEN}"),
))
.and(header("chatgpt-account-id", CHATGPT_ACCOUNT_ID))
.respond_with(ResponseTemplate::new(401).set_body_string("unauthorized"))
.expect(1)
.mount(&server)
@@ -743,7 +736,6 @@ async fn external_auth_401_retry_uses_refreshed_chatgpt_headers() -> anyhow::Res
"authorization",
format!("Bearer {REFRESHED_ACCESS_TOKEN}"),
))
.and(header("chatgpt-account-id", CHATGPT_ACCOUNT_ID))
.respond_with(
ResponseTemplate::new(200)
.insert_header("content-type", "text/event-stream")
@@ -788,8 +780,8 @@ async fn install_scripted_external_auth(
test: &core_test_support::test_codex::TestCodex,
) -> anyhow::Result<()> {
let external_auth = Arc::new(ScriptedExternalAuth {
current: Mutex::new(external_chatgpt_auth(INITIAL_ACCESS_TOKEN)?),
refreshed: external_chatgpt_auth(REFRESHED_ACCESS_TOKEN)?,
current: Mutex::new(external_bearer_auth(INITIAL_ACCESS_TOKEN)),
refreshed: external_bearer_auth(REFRESHED_ACCESS_TOKEN),
});
test.thread_manager
.auth_manager()