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:
@@ -1,6 +1,5 @@
|
||||
use anyhow::Context;
|
||||
use anyhow::Result;
|
||||
use app_test_support::ChatGptAuthFixture;
|
||||
use app_test_support::MockResponsesConfig;
|
||||
use app_test_support::TestAppServer;
|
||||
use app_test_support::create_apply_patch_sse_response;
|
||||
@@ -12,7 +11,7 @@ use app_test_support::create_mock_responses_server_repeating_assistant;
|
||||
use app_test_support::create_mock_responses_server_sequence;
|
||||
use app_test_support::create_mock_responses_server_sequence_unchecked;
|
||||
use app_test_support::format_with_current_shell_display;
|
||||
use app_test_support::write_chatgpt_auth;
|
||||
use app_test_support::write_api_key_auth;
|
||||
use app_test_support::write_mock_responses_config_toml_with_chatgpt_base_url;
|
||||
use app_test_support::write_models_cache;
|
||||
use app_test_support::write_models_cache_with_models;
|
||||
@@ -29,7 +28,6 @@ use codex_app_server_protocol::CollabAgentToolCallStatus;
|
||||
use codex_app_server_protocol::CommandExecutionApprovalDecision;
|
||||
use codex_app_server_protocol::CommandExecutionRequestApprovalResponse;
|
||||
use codex_app_server_protocol::CommandExecutionStatus;
|
||||
use codex_app_server_protocol::CyberAccessProgram;
|
||||
use codex_app_server_protocol::FileChangeApprovalDecision;
|
||||
use codex_app_server_protocol::FileChangePatchUpdatedNotification;
|
||||
use codex_app_server_protocol::FileChangeRequestApprovalResponse;
|
||||
@@ -54,8 +52,6 @@ use codex_app_server_protocol::ThreadInjectItemsParams;
|
||||
use codex_app_server_protocol::ThreadItemPayload;
|
||||
use codex_app_server_protocol::ThreadLoadedListParams;
|
||||
use codex_app_server_protocol::ThreadLoadedListResponse;
|
||||
use codex_app_server_protocol::ThreadMetadataUpdateParams;
|
||||
use codex_app_server_protocol::ThreadMetadataUpdateResponse;
|
||||
use codex_app_server_protocol::ThreadSettingsUpdateParams;
|
||||
use codex_app_server_protocol::ThreadSettingsUpdatedNotification;
|
||||
use codex_app_server_protocol::ThreadShellCommandParams;
|
||||
@@ -76,7 +72,6 @@ use codex_app_server_protocol::WarningNotification;
|
||||
use codex_core::test_support::all_model_presets;
|
||||
use codex_exec_server::LOCAL_ENVIRONMENT_ID;
|
||||
use codex_features::Feature;
|
||||
use codex_login::AuthCredentialsStoreMode;
|
||||
use codex_models_manager::model_info::model_info_from_slug;
|
||||
use codex_protocol::config_types::CollaborationMode;
|
||||
use codex_protocol::config_types::ModeKind;
|
||||
@@ -90,9 +85,12 @@ use codex_protocol::openai_models::ReasoningEffort;
|
||||
use codex_protocol::protocol::MULTI_AGENT_MODE_OPEN_TAG;
|
||||
use codex_protocol::user_input::MAX_USER_INPUT_TEXT_CHARS;
|
||||
use codex_utils_absolute_path::test_support::PathExt;
|
||||
use core_test_support::apps_test_server::AppsTestServer;
|
||||
use core_test_support::apps_test_server::SEARCH_CALENDAR_LIST_TOOL;
|
||||
use core_test_support::apps_test_server::SEARCH_CALENDAR_NAMESPACE;
|
||||
use core_test_support::mcp_test_server::CALENDAR_LIST_EVENTS_TOOL_NAME;
|
||||
use core_test_support::mcp_test_server::CALENDAR_NAMESPACE;
|
||||
use core_test_support::mcp_test_server::DIRECT_CALENDAR_LIST_EVENTS_TOOL;
|
||||
use core_test_support::mcp_test_server::MCP_TEST_SERVER_NAME;
|
||||
use core_test_support::mcp_test_server::MCP_TEST_SERVER_PATH;
|
||||
use core_test_support::mcp_test_server::McpTestServer;
|
||||
use core_test_support::responses;
|
||||
use core_test_support::skip_if_no_network;
|
||||
use core_test_support::skip_if_remote;
|
||||
@@ -363,8 +361,8 @@ async fn tool_call_metadata_stays_out_of_raw_response_item_notifications() -> Re
|
||||
responses::ev_response_created("resp-1"),
|
||||
responses::ev_function_call_with_namespace(
|
||||
"mcp-call",
|
||||
SEARCH_CALENDAR_NAMESPACE,
|
||||
SEARCH_CALENDAR_LIST_TOOL,
|
||||
CALENDAR_NAMESPACE,
|
||||
CALENDAR_LIST_EVENTS_TOOL_NAME,
|
||||
&arguments.to_string(),
|
||||
),
|
||||
responses::ev_completed("resp-1"),
|
||||
@@ -373,17 +371,17 @@ async fn tool_call_metadata_stays_out_of_raw_response_item_notifications() -> Re
|
||||
];
|
||||
let server = responses::start_mock_server().await;
|
||||
let model = responses::mount_sse_sequence(&server, responses).await;
|
||||
let apps = AppsTestServer::mount(&server).await?;
|
||||
let calendar = McpTestServer::mount(&server).await?;
|
||||
let tool_result = json!({
|
||||
"content": [{"type": "text", "text": "Calendar result"}],
|
||||
"_meta": result_metadata,
|
||||
"isError": false,
|
||||
});
|
||||
Mock::given(method("POST"))
|
||||
.and(path("/api/codex/ps/mcp"))
|
||||
.and(path(MCP_TEST_SERVER_PATH))
|
||||
.and(body_partial_json(json!({
|
||||
"method": "tools/call",
|
||||
"params": {"name": "calendar_list_events", "arguments": arguments},
|
||||
"params": {"name": CALENDAR_LIST_EVENTS_TOOL_NAME, "arguments": arguments},
|
||||
})))
|
||||
.respond_with(move |request: &Request| {
|
||||
let request: Value =
|
||||
@@ -402,22 +400,14 @@ async fn tool_call_metadata_stays_out_of_raw_response_item_notifications() -> Re
|
||||
MockResponsesConfig::new(&server.uri())
|
||||
.with_provider_name("OpenAI")
|
||||
.with_provider_config("supports_websockets = false")
|
||||
.with_root_config(&format!(
|
||||
"chatgpt_base_url = \"{}\"\ncli_auth_credentials_store = \"file\"",
|
||||
apps.chatgpt_base_url
|
||||
.with_root_config("cli_auth_credentials_store = \"file\"")
|
||||
.with_extra_config(&format!(
|
||||
"[mcp_servers.{MCP_TEST_SERVER_NAME}]\nurl = \"{}\"",
|
||||
calendar.mcp_url()
|
||||
))
|
||||
.enable_feature(Feature::Apps)
|
||||
.enable_feature(Feature::ExecutedToolCallMetadata)
|
||||
.write(codex_home.path())?;
|
||||
write_chatgpt_auth(
|
||||
codex_home.path(),
|
||||
ChatGptAuthFixture::new("chatgpt-test-token")
|
||||
.account_id("account-123")
|
||||
.chatgpt_account_id("account-123")
|
||||
.chatgpt_user_id("user-123")
|
||||
.email("employee@openai.com"),
|
||||
AuthCredentialsStoreMode::File,
|
||||
)?;
|
||||
write_api_key_auth(codex_home.path())?;
|
||||
|
||||
let mut mcp = TestAppServer::builder()
|
||||
.with_codex_home(codex_home.path())
|
||||
@@ -485,7 +475,7 @@ async fn tool_call_metadata_stays_out_of_raw_response_item_notifications() -> Re
|
||||
assert!(serde_json::to_string(&output["output"])?.contains("Calendar result"));
|
||||
assert_eq!(
|
||||
output["internal_chat_message_metadata_passthrough"]["executed_tool_calls"],
|
||||
json!([{"name": "mcp__codex_apps__calendar_list_events", "arguments": arguments}]),
|
||||
json!([{"name": DIRECT_CALENDAR_LIST_EVENTS_TOOL, "arguments": arguments}]),
|
||||
);
|
||||
assert_eq!(
|
||||
output["internal_chat_message_metadata_passthrough"]["tool_calls_complete"],
|
||||
@@ -658,11 +648,7 @@ async fn turn_start_steers_active_turn_and_returns_active_turn_id() -> Result<()
|
||||
server.uri()
|
||||
),
|
||||
)?;
|
||||
write_chatgpt_auth(
|
||||
codex_home.path(),
|
||||
ChatGptAuthFixture::new("chatgpt-test-token").plan_type("pro"),
|
||||
AuthCredentialsStoreMode::File,
|
||||
)?;
|
||||
write_api_key_auth(codex_home.path())?;
|
||||
let mut mcp = TestAppServer::builder()
|
||||
.with_codex_home(codex_home.path())
|
||||
.without_managed_config()
|
||||
@@ -688,7 +674,6 @@ async fn turn_start_steers_active_turn_and_returns_active_turn_id() -> Result<()
|
||||
turn_trigger: Some("goal".to_string()),
|
||||
parent_turn_id: Some("initiating-turn".to_string()),
|
||||
root_turn_id: Some("causal-root".to_string()),
|
||||
cyber_access_program: Some(CyberAccessProgram::DaybreakBlue),
|
||||
..Default::default()
|
||||
},
|
||||
})
|
||||
@@ -703,22 +688,6 @@ async fn turn_start_steers_active_turn_and_returns_active_turn_id() -> Result<()
|
||||
)
|
||||
.await?;
|
||||
|
||||
let updated: ThreadMetadataUpdateResponse = mcp
|
||||
.request(|request_id| ClientRequest::ThreadMetadataUpdate {
|
||||
request_id,
|
||||
params: ThreadMetadataUpdateParams {
|
||||
thread_id: thread.id.clone(),
|
||||
project_id: None,
|
||||
git_info: None,
|
||||
daybreak_enabled: Some(false),
|
||||
},
|
||||
})
|
||||
.await?;
|
||||
assert_eq!(
|
||||
(updated.thread.id, updated.thread.daybreak_enabled),
|
||||
(thread.id.clone(), Some(false))
|
||||
);
|
||||
|
||||
let TurnStartResponse { turn: steered_turn } = mcp
|
||||
.request(|request_id| ClientRequest::TurnStart {
|
||||
request_id,
|
||||
@@ -732,7 +701,6 @@ async fn turn_start_steers_active_turn_and_returns_active_turn_id() -> Result<()
|
||||
turn_trigger: Some("user".to_string()),
|
||||
parent_turn_id: Some("steering-turn".to_string()),
|
||||
root_turn_id: Some("steering-root".to_string()),
|
||||
cyber_access_program: Some(CyberAccessProgram::Standard),
|
||||
..Default::default()
|
||||
},
|
||||
})
|
||||
@@ -754,7 +722,6 @@ async fn turn_start_steers_active_turn_and_returns_active_turn_id() -> Result<()
|
||||
assert_eq!(requests.len(), 2);
|
||||
for request in requests {
|
||||
let body: Value = serde_json::from_slice(&request)?;
|
||||
assert_eq!(body["access_programs"], json!({"cyber": "daybreak_blue"}));
|
||||
let turn_metadata: Value = serde_json::from_str(
|
||||
body["client_metadata"]["x-codex-turn-metadata"]
|
||||
.as_str()
|
||||
@@ -1160,7 +1127,7 @@ async fn turn_start_emits_thread_scoped_warning_notification_for_trimmed_skills(
|
||||
assert_eq!(warning.thread_id.as_deref(), Some(thread.id.as_str()));
|
||||
assert_eq!(
|
||||
warning.message,
|
||||
"Exceeded skills context budget. All skill descriptions were removed and 6 additional skills were not included in the model-visible skills list."
|
||||
"Exceeded skills context budget. All skill descriptions were removed and 5 additional skills were not included in the model-visible skills list."
|
||||
);
|
||||
|
||||
timeout(
|
||||
@@ -3163,7 +3130,6 @@ async fn turn_start_explicit_local_environment_updates_legacy_cwd_between_turns(
|
||||
output_schema: None,
|
||||
collaboration_mode: None,
|
||||
multi_agent_mode: None,
|
||||
cyber_access_program: None,
|
||||
},
|
||||
})
|
||||
.await?;
|
||||
@@ -3214,7 +3180,6 @@ async fn turn_start_explicit_local_environment_updates_legacy_cwd_between_turns(
|
||||
output_schema: None,
|
||||
collaboration_mode: None,
|
||||
multi_agent_mode: None,
|
||||
cyber_access_program: None,
|
||||
},
|
||||
})
|
||||
.await?;
|
||||
@@ -5308,7 +5273,6 @@ async fn command_execution_notifications_include_trusted_plugin_id(
|
||||
.with_sandbox_mode("danger-full-access")
|
||||
.enable_feature(Feature::Plugins)
|
||||
.enable_feature(Feature::UnifiedExec)
|
||||
.disable_feature(Feature::RemotePlugin)
|
||||
.disable_feature(Feature::ShellSnapshot)
|
||||
.with_extra_config("[plugins.\"google-calendar@openai-api-curated\"]\nenabled = true")
|
||||
.write(codex_home.path())?;
|
||||
|
||||
Reference in New Issue
Block a user