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

@@ -3,11 +3,6 @@ use super::*;
use crate::error_code::OVERLOADED_ERROR_CODE;
use codex_app_server_protocol::FeedbackSaveParams;
use codex_app_server_protocol::FeedbackSaveResponse;
use codex_connectors::ConnectorDirectoryCacheContext;
use codex_connectors::ConnectorDirectoryCacheKey;
use codex_connectors::connector_runtime_cache_path;
use codex_feedback::CODEX_APP_DIRECTORY_CACHE_ATTACHMENT_FILENAME;
use codex_feedback::CODEX_APPS_TOOLS_CACHE_ATTACHMENT_FILENAME;
use codex_feedback::FeedbackAttachment;
use codex_feedback::FeedbackSnapshot;
#[cfg(target_os = "windows")]
@@ -28,7 +23,6 @@ struct SavedFeedback {
#[derive(Clone)]
pub(crate) struct FeedbackRequestProcessor {
auth_manager: Arc<AuthManager>,
thread_manager: Arc<ThreadManager>,
config: Arc<Config>,
feedback: CodexFeedback,
@@ -39,7 +33,6 @@ pub(crate) struct FeedbackRequestProcessor {
impl FeedbackRequestProcessor {
pub(crate) fn new(
auth_manager: Arc<AuthManager>,
thread_manager: Arc<ThreadManager>,
config: Arc<Config>,
feedback: CodexFeedback,
@@ -47,7 +40,6 @@ impl FeedbackRequestProcessor {
state_db: Option<StateDbHandle>,
) -> Self {
Self {
auth_manager,
thread_manager,
config,
feedback,
@@ -115,7 +107,6 @@ impl FeedbackRequestProcessor {
None => None,
};
let auth = self.auth_manager.auth_cached();
let turn_metadata = if let Some(conversation_id) = conversation_id
&& let Some(rollout_path) = self
.resolve_rollout_path(conversation_id, self.state_db.as_ref())
@@ -132,18 +123,6 @@ impl FeedbackRequestProcessor {
apply_feedback_turn_metadata(&mut report_tags, turn_metadata);
let prompt_hash = report_tags.get("prompt_hash").cloned();
if let Some(chatgpt_user_id) = auth
.as_ref()
.and_then(codex_login::CodexAuth::get_chatgpt_user_id)
{
tracing::info!(target: "feedback_tags", chatgpt_user_id);
}
if let Some(account_id) = auth
.as_ref()
.and_then(codex_login::CodexAuth::get_account_id)
{
tracing::info!(target: "feedback_tags", account_id);
}
let snapshot = self.feedback.snapshot(conversation_id);
let mut extra_attachments = Vec::new();
let mut feedback_index = None;
@@ -255,15 +234,6 @@ impl FeedbackRequestProcessor {
{
attachment_paths.push(sandbox_log_attachment);
}
for cache_attachment in tool_cache_feedback_attachments(
self.config.codex_home.as_path(),
&self.config.chatgpt_base_url,
auth.as_ref(),
) {
if seen_attachment_paths.insert(cache_attachment.path.clone()) {
attachment_paths.push(cache_attachment);
}
}
}
if let Some(extra_log_files) = extra_log_files {
for extra_log_file in extra_log_files {
@@ -461,47 +431,6 @@ fn normalized_prompt_hash(prompt: &str) -> String {
format!("{:x}", Sha256::digest(normalized_prompt.as_bytes()))
}
fn tool_cache_feedback_attachments(
codex_home: &Path,
chatgpt_base_url: &str,
auth: Option<&CodexAuth>,
) -> Vec<FeedbackAttachmentPath> {
let mut attachments = Vec::with_capacity(2);
let tools_cache_path = connector_runtime_cache_path(codex_home, auth);
if tools_cache_path.is_file() {
attachments.push(FeedbackAttachmentPath {
path: tools_cache_path,
attachment_filename_override: Some(
CODEX_APPS_TOOLS_CACHE_ATTACHMENT_FILENAME.to_string(),
),
});
}
let Some(auth) = auth.filter(|auth| auth.uses_codex_backend()) else {
return attachments;
};
let directory_cache_context = ConnectorDirectoryCacheContext::new(
codex_home.to_path_buf(),
ConnectorDirectoryCacheKey::new(
chatgpt_base_url.to_string(),
auth.get_account_id(),
auth.get_chatgpt_user_id(),
auth.is_workspace_account(),
),
);
let directory_cache_path = directory_cache_context.cache_path();
if directory_cache_path.is_file() {
attachments.push(FeedbackAttachmentPath {
path: directory_cache_path,
attachment_filename_override: Some(
CODEX_APP_DIRECTORY_CACHE_ATTACHMENT_FILENAME.to_string(),
),
});
}
attachments
}
fn auto_review_rollout_filename(thread_id: ThreadId) -> String {
format!("auto-review-rollout-{thread_id}.jsonl")
}
@@ -589,7 +518,6 @@ mod tests {
use codex_rollout::RolloutLine;
use core_test_support::responses::start_mock_server;
use core_test_support::test_codex::test_codex;
use http::HeaderMap;
use pretty_assertions::assert_eq;
#[tokio::test]
@@ -826,7 +754,6 @@ mod tests {
collaboration_mode: None,
multi_agent_version: None,
realtime_active: None,
cyber_access_program: None,
effort: effort.clone(),
summary: Some(ReasoningSummary::Auto),
}),
@@ -843,98 +770,6 @@ mod tests {
(tempdir, rollout_path)
}
#[test]
fn tool_cache_feedback_attachments_include_existing_active_cache_files() {
let codex_home = tempfile::tempdir().expect("create tempdir");
let auth = CodexAuth::create_dummy_chatgpt_auth_for_testing();
let tools_cache_path = connector_runtime_cache_path(codex_home.path(), Some(&auth));
std::fs::create_dir_all(tools_cache_path.parent().expect("tools cache parent"))
.expect("create tools cache directory");
std::fs::write(&tools_cache_path, b"tools").expect("write tools cache");
let account_id = auth.get_account_id().expect("dummy auth account id");
let directory_cache_context = ConnectorDirectoryCacheContext::new(
codex_home.path().to_path_buf(),
ConnectorDirectoryCacheKey::new(
"https://chatgpt.com/backend-api".to_string(),
Some(account_id),
auth.get_chatgpt_user_id(),
auth.is_workspace_account(),
),
);
let directory_cache_path = directory_cache_context.cache_path();
std::fs::create_dir_all(
directory_cache_path
.parent()
.expect("directory cache parent"),
)
.expect("create directory cache directory");
std::fs::write(&directory_cache_path, b"directory").expect("write directory cache");
let attachments = tool_cache_feedback_attachments(
codex_home.path(),
"https://chatgpt.com/backend-api",
Some(&auth),
)
.into_iter()
.map(|attachment| (attachment.path, attachment.attachment_filename_override))
.collect::<Vec<_>>();
assert_eq!(
attachments,
vec![
(
tools_cache_path,
Some(CODEX_APPS_TOOLS_CACHE_ATTACHMENT_FILENAME.to_string()),
),
(
directory_cache_path,
Some(CODEX_APP_DIRECTORY_CACHE_ATTACHMENT_FILENAME.to_string()),
),
]
);
}
#[test]
fn tool_cache_feedback_attachments_include_directory_cache_without_account_id() {
let codex_home = tempfile::tempdir().expect("create tempdir");
let auth = CodexAuth::Headers(codex_login::AuthHeaders::new(HeaderMap::new()));
let directory_cache_context = ConnectorDirectoryCacheContext::new(
codex_home.path().to_path_buf(),
ConnectorDirectoryCacheKey::new(
"https://chatgpt.com/backend-api".to_string(),
/*account_id*/ None,
auth.get_chatgpt_user_id(),
auth.is_workspace_account(),
),
);
let directory_cache_path = directory_cache_context.cache_path();
std::fs::create_dir_all(
directory_cache_path
.parent()
.expect("directory cache parent"),
)
.expect("create directory cache directory");
std::fs::write(&directory_cache_path, b"directory").expect("write directory cache");
let attachments = tool_cache_feedback_attachments(
codex_home.path(),
"https://chatgpt.com/backend-api",
Some(&auth),
)
.into_iter()
.map(|attachment| (attachment.path, attachment.attachment_filename_override))
.collect::<Vec<_>>();
assert_eq!(
attachments,
vec![(
directory_cache_path,
Some(CODEX_APP_DIRECTORY_CACHE_ATTACHMENT_FILENAME.to_string()),
)]
);
}
#[cfg(target_os = "windows")]
#[test]
fn windows_sandbox_log_attachment_uses_current_log() {