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:
@@ -20,17 +20,17 @@ use codex_extension_api::ToolLifecycleContributor;
|
||||
use codex_extension_api::ToolLifecycleFuture;
|
||||
use codex_extension_api::ToolStartInput;
|
||||
use codex_features::Feature;
|
||||
use codex_mcp::CODEX_APPS_MCP_SERVER_NAME;
|
||||
use core_test_support::mcp_test_server::MCP_TEST_SERVER_NAME;
|
||||
use codex_protocol::mcp::CallToolResult;
|
||||
use codex_protocol::models::ContentItem;
|
||||
use codex_protocol::protocol::EventMsg;
|
||||
use codex_protocol::user_input::UserInput;
|
||||
use codex_utils_path_uri::PathUri;
|
||||
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::apps_test_server::apps_enabled_builder;
|
||||
use core_test_support::apps_test_server::recorded_apps_tool_call_by_call_id;
|
||||
use core_test_support::mcp_test_server::McpTestServer;
|
||||
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::mcp_server_builder;
|
||||
use core_test_support::mcp_test_server::recorded_mcp_tool_call_by_call_id;
|
||||
use core_test_support::hooks::trust_discovered_hooks;
|
||||
use core_test_support::responses;
|
||||
use core_test_support::skip_if_no_network;
|
||||
@@ -61,7 +61,7 @@ struct RecordedHistory {
|
||||
call_id: String,
|
||||
arguments: String,
|
||||
items: Vec<ResponseItem>,
|
||||
mcp_tool: Option<(String, Option<String>, McpToolSource)>,
|
||||
mcp_tool: Option<(String, McpToolSource)>,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
@@ -71,7 +71,7 @@ struct ConversationHistoryRecorder {
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
enum AppsServerOwner {
|
||||
Host,
|
||||
Config,
|
||||
Extension,
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ impl McpServerContributor<Config> for ExtensionOwnedAppsServer {
|
||||
let config = serde_json::from_value(json!({ "url": self.url }))
|
||||
.expect("test Apps MCP server config should be valid");
|
||||
vec![McpServerContribution::Set {
|
||||
name: CODEX_APPS_MCP_SERVER_NAME.to_string(),
|
||||
name: MCP_TEST_SERVER_NAME.to_string(),
|
||||
config: Box::new(config),
|
||||
}]
|
||||
})
|
||||
@@ -112,7 +112,6 @@ impl ToolLifecycleContributor for ConversationHistoryRecorder {
|
||||
mcp_tool: input.mcp_tool.map(|tool| {
|
||||
(
|
||||
tool.tool_info().server_name.clone(),
|
||||
tool.tool_info().connector_id.clone(),
|
||||
tool.source().clone(),
|
||||
)
|
||||
}),
|
||||
@@ -231,17 +230,17 @@ async fn tool_start_receives_conversation_history() -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test_case(AppsServerOwner::Host, McpToolSource::Connector; "host_owned_apps")]
|
||||
#[test_case(AppsServerOwner::Extension, McpToolSource::Other; "extension_owned_apps")]
|
||||
#[test_case(AppsServerOwner::Config, McpToolSource::Config; "user_configured_server")]
|
||||
#[test_case(AppsServerOwner::Extension, McpToolSource::Other; "extension_owned_server")]
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn tool_start_receives_executed_mcp_call_for_connector(
|
||||
async fn tool_start_receives_executed_mcp_call_for_server(
|
||||
owner: AppsServerOwner,
|
||||
expected_source: McpToolSource,
|
||||
) -> Result<()> {
|
||||
skip_if_no_network!(Ok(()));
|
||||
|
||||
let server = responses::start_mock_server().await;
|
||||
let apps_server = AppsTestServer::mount(&server).await?;
|
||||
let apps_server = McpTestServer::mount(&server).await?;
|
||||
let call_id = "calendar-lifecycle-call";
|
||||
responses::mount_sse_sequence(
|
||||
&server,
|
||||
@@ -249,8 +248,8 @@ async fn tool_start_receives_executed_mcp_call_for_connector(
|
||||
responses::sse(vec![
|
||||
responses::ev_function_call_with_namespace(
|
||||
call_id,
|
||||
SEARCH_CALENDAR_NAMESPACE,
|
||||
SEARCH_CALENDAR_LIST_TOOL,
|
||||
CALENDAR_NAMESPACE,
|
||||
CALENDAR_LIST_EVENTS_TOOL_NAME,
|
||||
"{}",
|
||||
),
|
||||
responses::ev_completed("first-response"),
|
||||
@@ -268,14 +267,14 @@ async fn tool_start_receives_executed_mcp_call_for_connector(
|
||||
extensions.tool_lifecycle_contributor(recorder.clone());
|
||||
if matches!(owner, AppsServerOwner::Extension) {
|
||||
extensions.mcp_server_contributor(Arc::new(ExtensionOwnedAppsServer {
|
||||
url: format!("{}/api/codex/ps/mcp", apps_server.chatgpt_base_url),
|
||||
url: format!("{}/mcp", apps_server.base_url),
|
||||
}));
|
||||
}
|
||||
let test = apps_enabled_builder(apps_server.chatgpt_base_url)
|
||||
let test = mcp_server_builder(apps_server.base_url)
|
||||
.with_extensions(Arc::new(extensions.build()))
|
||||
.build_with_auto_env(&server)
|
||||
.await?;
|
||||
wait_for_mcp_server(&test.codex, CODEX_APPS_MCP_SERVER_NAME).await?;
|
||||
wait_for_mcp_server(&test.codex, MCP_TEST_SERVER_NAME).await?;
|
||||
|
||||
test.submit_text_turn("List my calendar events.").await?;
|
||||
|
||||
@@ -290,27 +289,17 @@ async fn tool_start_receives_executed_mcp_call_for_connector(
|
||||
assert_eq!(history.call_id, call_id);
|
||||
assert_eq!(
|
||||
history.mcp_tool,
|
||||
Some((
|
||||
CODEX_APPS_MCP_SERVER_NAME.to_string(),
|
||||
Some("calendar".to_string()),
|
||||
expected_source,
|
||||
)),
|
||||
Some((MCP_TEST_SERVER_NAME.to_string(), expected_source)),
|
||||
);
|
||||
}
|
||||
|
||||
let executed_call = recorded_apps_tool_call_by_call_id(&server, call_id).await;
|
||||
let executed_call = recorded_mcp_tool_call_by_call_id(&server, call_id).await;
|
||||
assert_eq!(
|
||||
executed_call
|
||||
.pointer("/params/name")
|
||||
.and_then(Value::as_str),
|
||||
Some("calendar_list_events")
|
||||
);
|
||||
if matches!(owner, AppsServerOwner::Extension) {
|
||||
assert_eq!(
|
||||
executed_call.pointer("/params/_meta/_codex_apps/root_turn_id"),
|
||||
None
|
||||
);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -337,7 +326,7 @@ struct BlockingMcpResultContributor {
|
||||
impl ToolLifecycleContributor for BlockingMcpResultContributor {
|
||||
fn on_mcp_tool_result<'a>(&'a self, input: McpToolResultInput<'a>) -> ToolLifecycleFuture<'a> {
|
||||
Box::pin(async move {
|
||||
assert_eq!(input.mcp_tool.source(), &McpToolSource::Connector);
|
||||
assert_eq!(input.mcp_tool.source(), &McpToolSource::Config);
|
||||
assert_eq!(input.mcp_tool.tool_info().tool.name, "calendar_list_events");
|
||||
assert_eq!(input.arguments, &json!({"query": "callback test"}));
|
||||
self.entered
|
||||
@@ -368,7 +357,7 @@ async fn mcp_result_processing_precedes_completion(
|
||||
skip_if_no_network!(Ok(()));
|
||||
|
||||
let server = responses::start_mock_server().await;
|
||||
let apps_server = AppsTestServer::mount(&server).await?;
|
||||
let apps_server = McpTestServer::mount(&server).await?;
|
||||
let server_result: CallToolResult = serde_json::from_value(json!({
|
||||
"content": [{"type": "text", "text": "server result"}],
|
||||
"structuredContent": {"text": "server result"},
|
||||
@@ -409,7 +398,7 @@ async fn mcp_result_processing_precedes_completion(
|
||||
});
|
||||
let mut extensions = ExtensionRegistryBuilder::<Config>::new();
|
||||
extensions.tool_lifecycle_contributor(contributor.clone());
|
||||
let test = apps_enabled_builder(apps_server.chatgpt_base_url)
|
||||
let test = mcp_server_builder(apps_server.base_url)
|
||||
.with_extensions(Arc::new(extensions.build()))
|
||||
.with_config(move |config| {
|
||||
if matches!(mode, McpCallMode::CodeMode) {
|
||||
@@ -418,14 +407,14 @@ async fn mcp_result_processing_precedes_completion(
|
||||
})
|
||||
.build_with_auto_env(&server)
|
||||
.await?;
|
||||
wait_for_mcp_server(&test.codex, CODEX_APPS_MCP_SERVER_NAME).await?;
|
||||
wait_for_mcp_server(&test.codex, MCP_TEST_SERVER_NAME).await?;
|
||||
|
||||
let call_id = "mcp-result-call";
|
||||
let call = match mode {
|
||||
McpCallMode::Direct => responses::ev_function_call_with_namespace(
|
||||
call_id,
|
||||
SEARCH_CALENDAR_NAMESPACE,
|
||||
SEARCH_CALENDAR_LIST_TOOL,
|
||||
CALENDAR_NAMESPACE,
|
||||
CALENDAR_LIST_EVENTS_TOOL_NAME,
|
||||
r#"{"query":"callback test"}"#,
|
||||
),
|
||||
McpCallMode::CodeMode => responses::ev_custom_tool_call(
|
||||
@@ -563,7 +552,7 @@ async fn tool_start_receives_frozen_host_plugin_root() -> Result<()> {
|
||||
};
|
||||
assert_eq!(
|
||||
history.mcp_tool,
|
||||
Some(("sample".to_string(), None, expected_source)),
|
||||
Some(("sample".to_string(), expected_source)),
|
||||
);
|
||||
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user