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

@@ -4,11 +4,6 @@ mod daemon_continuation;
#[path = "daemon_snapshot.rs"]
mod daemon_snapshot;
mod workspace_switching;
#[path = "thread_resume_account.rs"]
mod thread_resume_account;
use super::persisted_resume_settings::PersistedResumeSettings;
use super::persisted_resume_settings::latest_owned_thread_settings;
use super::persisted_resume_settings::latest_persisted_model_settings;
@@ -1296,7 +1291,6 @@ impl ThreadRequestProcessor {
session_start_source,
thread_source,
project_id,
daybreak_enabled,
environments,
} = params;
if matches!(
@@ -1381,7 +1375,6 @@ impl ThreadRequestProcessor {
session_start_source,
thread_source.map(Into::into),
project_id,
daybreak_enabled,
environment_requests,
service_name,
allow_provider_model_fallback,
@@ -1463,7 +1456,6 @@ impl ThreadRequestProcessor {
session_start_source: Option<codex_app_server_protocol::ThreadStartSource>,
thread_source: Option<codex_protocol::protocol::ThreadSource>,
project_id: Option<String>,
daybreak_enabled: Option<bool>,
environment_requests: Option<Vec<TurnEnvironmentRequest>>,
service_name: Option<String>,
allow_provider_model_fallback: bool,
@@ -1477,11 +1469,6 @@ impl ThreadRequestProcessor {
.load_with_overrides(config_overrides.clone(), typesafe_overrides.clone())
.await
.map_err(|err| config_load_error(&err))?;
if config.ephemeral && daybreak_enabled.is_some() {
return Err(invalid_request(
"daybreakEnabled is not supported for ephemeral threads",
));
}
// Project-local config can launch host processes, so only the effective
// permissions after managed constraints can imply project trust.
let effective_permission_profile = config.permissions.effective_permission_profile();
@@ -1611,7 +1598,6 @@ impl ThreadRequestProcessor {
thread_store.as_ref(),
StoreThreadMetadataPatch {
project_id: project_id.clone().map(Some),
daybreak_enabled,
..Default::default()
},
"thread/start",
@@ -1622,7 +1608,7 @@ impl ThreadRequestProcessor {
.unwrap_or_else(|| listener_task_context.thread_manager.reserve_thread_id());
start_options.reserved_thread_id = Some(thread_id);
// Startup can prewarm the Responses socket before start_thread returns.
// Register the creating client first so that handshake can request attestation.
// Register the creating client first so it observes the startup handshake.
listener_task_context
.thread_state_manager
.try_add_connection_to_thread(thread_id, request_id.connection_id)
@@ -1706,7 +1692,6 @@ impl ThreadRequestProcessor {
session_configured.rollout_path.clone(),
);
thread.project_id = project_id.clone();
thread.daybreak_enabled = daybreak_enabled;
// Auto-attach a thread listener when starting a thread.
log_listener_attach_result(
@@ -2057,7 +2042,6 @@ impl ThreadRequestProcessor {
thread_id,
project_id,
git_info,
daybreak_enabled,
} = params;
let thread_uuid = ThreadId::from_string(&thread_id)
.map_err(|err| invalid_request(format!("invalid thread id: {err}")))?;
@@ -2080,7 +2064,7 @@ impl ThreadRequestProcessor {
}
}
if git_info.is_none() && project_id.is_none() && daybreak_enabled.is_none() {
if git_info.is_none() && project_id.is_none() {
return Err(invalid_request(
"thread metadata update must include at least one field",
));
@@ -2158,7 +2142,6 @@ impl ThreadRequestProcessor {
let patch = StoreThreadMetadataPatch {
git_info,
project_id: project_update.clone(),
daybreak_enabled,
..Default::default()
};
let updated_thread = self
@@ -2283,15 +2266,7 @@ impl ThreadRequestProcessor {
"thread/revert only supports paginated threads",
));
}
let mut config = thread.config().await.as_ref().clone();
// Give the replacement its own pending lifetime before removal revokes the old runtime.
let ema_cancellation = config
.config_layer_stack
.mcp_ema_cancellation()
.for_startup();
config.config_layer_stack = config
.config_layer_stack
.with_mcp_ema_cancellation(ema_cancellation);
let config = thread.config().await.as_ref().clone();
let runtime_snapshot = ThreadRevertRuntimeSnapshot {
config,
settings: thread.restorable_thread_settings().await,
@@ -3128,17 +3103,6 @@ impl ThreadRequestProcessor {
thread_id: ThreadId,
include_turns: bool,
) -> Result<Thread, ThreadReadViewError> {
// Read staging first: persistence can consume it while the stored thread is read.
let pending_daybreak_enabled = self
.thread_store
.read_pending_thread_metadata(thread_id)
.await
.map_err(|err| {
ThreadReadViewError::Internal(format!(
"failed to read pending thread metadata: {err}"
))
})?
.and_then(|metadata| metadata.daybreak_enabled);
let loaded_thread = self.thread_manager.get_thread(thread_id).await.ok();
let mut thread = if include_turns {
if let Some(loaded_thread) = loaded_thread.as_ref() {
@@ -3192,8 +3156,6 @@ impl ThreadRequestProcessor {
)));
};
thread.daybreak_enabled = thread.daybreak_enabled.or(pending_daybreak_enabled);
let has_live_in_progress_turn = if let Some(loaded_thread) = loaded_thread.as_ref() {
matches!(loaded_thread.agent_status().await, AgentStatus::Running)
} else {
@@ -3920,13 +3882,9 @@ impl ThreadRequestProcessor {
self.thread_manager.subscribe_thread_created()
}
pub(crate) async fn connection_initialized(
&self,
connection_id: ConnectionId,
capabilities: ConnectionCapabilities,
) {
pub(crate) async fn connection_initialized(&self, connection_id: ConnectionId) {
self.thread_state_manager
.connection_initialized(connection_id, capabilities)
.connection_initialized(connection_id)
.await;
}
@@ -4074,12 +4032,6 @@ impl ThreadRequestProcessor {
.await?
}
};
thread_resume_account::check(
&self.config.features,
app_server_client_name.as_deref(),
&self.auth_manager,
&stored_thread,
)?;
let (thread_history, stored_thread) = self
.load_resume_initial_history_from_stored_thread(
stored_thread,
@@ -4726,12 +4678,6 @@ impl ThreadRequestProcessor {
};
if let Some((existing_thread_id, existing_thread, mut source_thread)) = running_thread {
thread_resume_account::check(
&self.config.features,
app_server_client_name.as_deref(),
&self.auth_manager,
&source_thread,
)?;
let paginated_resume =
matches!(source_thread.history_mode, ThreadHistoryMode::Paginated);
let existing_thread_rollout_path = existing_thread.rollout_path();
@@ -5736,7 +5682,6 @@ impl ThreadRequestProcessor {
self.thread_store.as_ref(),
StoreThreadMetadataPatch {
project_id: inherited_project_id.clone().map(Some),
daybreak_enabled: source_thread.daybreak_enabled,
..Default::default()
},
"thread/fork",
@@ -6043,8 +5988,8 @@ impl ThreadRequestProcessor {
return None;
}
Some(LocalHistoryAccount {
user_id: auth.as_ref().and_then(CodexAuth::get_chatgpt_user_id),
account_id: auth.as_ref().and_then(CodexAuth::get_account_id),
user_id: None,
account_id: None,
})
}
@@ -6749,7 +6694,6 @@ fn thread_from_stored_thread(
thread_source: thread.thread_source.map(Into::into),
git_info,
name: thread.name,
daybreak_enabled: thread.daybreak_enabled,
turns: Vec::new(),
};
(thread, history)
@@ -6935,7 +6879,6 @@ fn build_thread_from_snapshot(
thread_source: config_snapshot.thread_source.clone().map(Into::into),
git_info: None,
name: None,
daybreak_enabled: None,
turns: Vec::new(),
}
}