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

@@ -32,7 +32,6 @@ use tokio_tungstenite::tungstenite::Message;
use tokio_tungstenite::tungstenite::handshake::client::Request;
use tokio_tungstenite::tungstenite::handshake::client::Response;
use tokio_tungstenite::tungstenite::http::Uri;
use tokio_tungstenite::tungstenite::http::header::COOKIE;
use tokio_tungstenite::tungstenite::protocol::WebSocketConfig;
/// Recovers a deterministic policy denial from Tungstenite's I/O error boundary.
@@ -164,7 +163,7 @@ impl WebSocketConnector {
async fn connect_with_route(
&self,
mut request: Request,
request: Request,
config: WebSocketConfig,
route: impl std::future::Future<Output = io::Result<OutboundProxyRoute>>,
loopback_direct: bool,
@@ -182,13 +181,8 @@ impl WebSocketConnector {
.acquire(&url)
.map_err(policy_error)?;
let connect = async {
if !request.headers().contains_key(COOKIE)
&& let Some(cookies) = self.http_client_factory.chatgpt_cookie_header(&uri)
{
request.headers_mut().insert(COOKIE, cookies);
}
let proxy_route = route.await.map_err(WebSocketError::Io)?;
let result = dialer::connect(
dialer::connect(
request,
config,
self.tls_config.clone(),
@@ -197,30 +191,10 @@ impl WebSocketConnector {
loopback_direct,
)
.boxed()
.await;
// Like HTTP responses, rejected upgrades can also refresh infrastructure cookies.
match &result {
Ok((_, response)) => self
.http_client_factory
.store_chatgpt_response_cookies(&uri, response.headers()),
Err(WebSocketError::Http(response)) => self
.http_client_factory
.store_chatgpt_response_cookies(&uri, response.headers()),
Err(_) => {}
}
result.map(|(inner, response)| {
let routing_affinity = codex_http_client::ChatGptRoutingAffinity::from_response(
&uri,
response.headers(),
);
(inner, response, routing_affinity)
})
.await
};
let (inner, response, routing_affinity) =
permit.run(connect).await.map_err(policy_error)??;
let mut connection = WebSocketConnection::new(inner, permit);
connection.routing_affinity = routing_affinity;
Ok((connection, response))
let (inner, response) = permit.run(connect).await.map_err(policy_error)??;
Ok((WebSocketConnection::new(inner, permit), response))
}
}
@@ -244,7 +218,6 @@ fn is_loopback_destination(uri: &Uri) -> bool {
/// without knowing which concrete network stream route selection produced. Independent revocation
/// waits preserve both task wakers when the stream and sink are split.
pub struct WebSocketConnection {
routing_affinity: Option<codex_http_client::ChatGptRoutingAffinity>,
inner: Option<ConnectionInner>,
permit: NetworkPermit,
read_revoked: BoxFuture<'static, ()>,
@@ -269,7 +242,6 @@ impl WebSocketConnection {
let read_permit = permit.clone();
let write_permit = permit.clone();
Self {
routing_affinity: None,
inner: Some(inner),
permit,
read_revoked: async move { read_permit.revoked().await }.boxed(),
@@ -278,11 +250,6 @@ impl WebSocketConnection {
}
}
/// The scoped routing cookie from this connection's handshake, never account cookies.
pub fn routing_affinity(&self) -> Option<&codex_http_client::ChatGptRoutingAffinity> {
self.routing_affinity.as_ref()
}
fn poll_policy(
&mut self,
context: &mut Context<'_>,